[llvm-branch-commits] [lldb] r186540 - Merge top of tree.

Greg Clayton gclayton at apple.com
Wed Jul 17 15:19:38 PDT 2013


Author: gclayton
Date: Wed Jul 17 17:17:41 2013
New Revision: 186540

URL: http://llvm.org/viewvc/llvm-project?rev=186540&view=rev
Log:
Merge top of tree.


Added:
    lldb/branches/lldb-platform-work/examples/python/memory.py
      - copied unchanged from r186537, lldb/trunk/examples/python/memory.py
    lldb/branches/lldb-platform-work/include/lldb/API/SBModuleSpec.h
      - copied unchanged from r186537, lldb/trunk/include/lldb/API/SBModuleSpec.h
    lldb/branches/lldb-platform-work/scripts/Python/interface/SBModuleSpec.i
      - copied unchanged from r186537, lldb/trunk/scripts/Python/interface/SBModuleSpec.i
    lldb/branches/lldb-platform-work/source/API/SBModuleSpec.cpp
      - copied unchanged from r186537, lldb/trunk/source/API/SBModuleSpec.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/
      - copied from r186537, lldb/trunk/source/Plugins/Process/elf-core/
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/CMakeLists.txt
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/Makefile
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/Makefile
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/ProcessElfCore.cpp
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/ProcessElfCore.h
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.cpp
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.h
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/ThreadElfCore.cpp
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/elf-core/ThreadElfCore.h
      - copied unchanged from r186537, lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.h
    lldb/branches/lldb-platform-work/test/functionalities/longjmp/
      - copied from r186537, lldb/trunk/test/functionalities/longjmp/
    lldb/branches/lldb-platform-work/test/functionalities/longjmp/Makefile
      - copied unchanged from r186537, lldb/trunk/test/functionalities/longjmp/Makefile
    lldb/branches/lldb-platform-work/test/functionalities/longjmp/TestLongjmp.py
      - copied unchanged from r186537, lldb/trunk/test/functionalities/longjmp/TestLongjmp.py
    lldb/branches/lldb-platform-work/test/functionalities/longjmp/main.c
      - copied unchanged from r186537, lldb/trunk/test/functionalities/longjmp/main.c
    lldb/branches/lldb-platform-work/test/functionalities/thread/concurrent_events/
      - copied from r186537, lldb/trunk/test/functionalities/thread/concurrent_events/
    lldb/branches/lldb-platform-work/test/functionalities/thread/concurrent_events/Makefile
      - copied unchanged from r186537, lldb/trunk/test/functionalities/thread/concurrent_events/Makefile
    lldb/branches/lldb-platform-work/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
      - copied unchanged from r186537, lldb/trunk/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
    lldb/branches/lldb-platform-work/test/functionalities/thread/concurrent_events/main.cpp
      - copied unchanged from r186537, lldb/trunk/test/functionalities/thread/concurrent_events/main.cpp
    lldb/branches/lldb-platform-work/test/functionalities/thread/step_out/
      - copied from r186537, lldb/trunk/test/functionalities/thread/step_out/
    lldb/branches/lldb-platform-work/test/functionalities/thread/step_out/Makefile
      - copied unchanged from r186537, lldb/trunk/test/functionalities/thread/step_out/Makefile
    lldb/branches/lldb-platform-work/test/functionalities/thread/step_out/TestThreadStepOut.py
      - copied unchanged from r186537, lldb/trunk/test/functionalities/thread/step_out/TestThreadStepOut.py
    lldb/branches/lldb-platform-work/test/functionalities/thread/step_out/main.cpp
      - copied unchanged from r186537, lldb/trunk/test/functionalities/thread/step_out/main.cpp
    lldb/branches/lldb-platform-work/test/lang/objc/objc-struct-return/
      - copied from r186537, lldb/trunk/test/lang/objc/objc-struct-return/
    lldb/branches/lldb-platform-work/test/lang/objc/objc-struct-return/Makefile
      - copied unchanged from r186537, lldb/trunk/test/lang/objc/objc-struct-return/Makefile
    lldb/branches/lldb-platform-work/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
      - copied unchanged from r186537, lldb/trunk/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
    lldb/branches/lldb-platform-work/test/lang/objc/objc-struct-return/test.m
      - copied unchanged from r186537, lldb/trunk/test/lang/objc/objc-struct-return/test.m
Removed:
    lldb/branches/lldb-platform-work/include/lldb/Core/cxa_demangle.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeHierarchyNavigator.h
    lldb/branches/lldb-platform-work/source/Core/cxa_demangle.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/RegisterContextFreeBSD_x86_64.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
    lldb/branches/lldb-platform-work/source/Symbol/TypeHierarchyNavigator.cpp
Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/examples/python/cmdtemplate.py
    lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py
    lldb/branches/lldb-platform-work/examples/python/types.py
    lldb/branches/lldb-platform-work/include/lldb/API/SBDefines.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBFileSpec.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBStream.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBType.h
    lldb/branches/lldb-platform-work/include/lldb/Core/DataBufferHeap.h
    lldb/branches/lldb-platform-work/include/lldb/Core/Module.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ModuleSpec.h
    lldb/branches/lldb-platform-work/include/lldb/Core/PluginManager.h
    lldb/branches/lldb-platform-work/include/lldb/Core/RangeMap.h
    lldb/branches/lldb-platform-work/include/lldb/Core/Section.h
    lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h
    lldb/branches/lldb-platform-work/include/lldb/Core/Value.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectCast.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectChild.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResult.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResultChild.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectDynamicValue.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectMemory.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectRegister.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectSyntheticFilter.h
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectVariable.h
    lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h
    lldb/branches/lldb-platform-work/include/lldb/Expression/ASTDumper.h
    lldb/branches/lldb-platform-work/include/lldb/Expression/ClangASTSource.h
    lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionDeclMap.h
    lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionVariable.h
    lldb/branches/lldb-platform-work/include/lldb/Expression/ClangFunction.h
    lldb/branches/lldb-platform-work/include/lldb/Expression/DWARFExpression.h
    lldb/branches/lldb-platform-work/include/lldb/Host/ReadWriteLock.h
    lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandHistory.h
    lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h
    lldb/branches/lldb-platform-work/include/lldb/Interpreter/PythonDataObjects.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTImporter.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/Function.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/Symtab.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/TaggedASTType.h
    lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h
    lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
    lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOut.h
    lldb/branches/lldb-platform-work/lib/Makefile
    lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
    lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
    lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
    lldb/branches/lldb-platform-work/resources/LLDB-Info.plist
    lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh
    lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i
    lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i
    lldb/branches/lldb-platform-work/scripts/Python/interface/SBTarget.i
    lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig
    lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig
    lldb/branches/lldb-platform-work/scripts/lldb.swig
    lldb/branches/lldb-platform-work/source/API/CMakeLists.txt
    lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp
    lldb/branches/lldb-platform-work/source/API/SBFileSpec.cpp
    lldb/branches/lldb-platform-work/source/API/SBModule.cpp
    lldb/branches/lldb-platform-work/source/API/SBTarget.cpp
    lldb/branches/lldb-platform-work/source/API/SBType.cpp
    lldb/branches/lldb-platform-work/source/API/SBValue.cpp
    lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocationList.cpp
    lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp
    lldb/branches/lldb-platform-work/source/CMakeLists.txt
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectSource.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.cpp
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.h
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp
    lldb/branches/lldb-platform-work/source/Core/CMakeLists.txt
    lldb/branches/lldb-platform-work/source/Core/DataBufferHeap.cpp
    lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
    lldb/branches/lldb-platform-work/source/Core/Disassembler.cpp
    lldb/branches/lldb-platform-work/source/Core/Makefile
    lldb/branches/lldb-platform-work/source/Core/Mangled.cpp
    lldb/branches/lldb-platform-work/source/Core/Module.cpp
    lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp
    lldb/branches/lldb-platform-work/source/Core/PluginManager.cpp
    lldb/branches/lldb-platform-work/source/Core/Section.cpp
    lldb/branches/lldb-platform-work/source/Core/UUID.cpp
    lldb/branches/lldb-platform-work/source/Core/Value.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectCast.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectChild.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResult.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultChild.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultImpl.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectDynamicValue.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectMemory.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectRegister.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectSyntheticFilter.cpp
    lldb/branches/lldb-platform-work/source/Core/ValueObjectVariable.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/Cocoa.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/LibCxx.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxList.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxMap.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/LibStdcpp.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/NSArray.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/NSDictionary.cpp
    lldb/branches/lldb-platform-work/source/DataFormatters/NSSet.cpp
    lldb/branches/lldb-platform-work/source/Expression/ASTDumper.cpp
    lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp
    lldb/branches/lldb-platform-work/source/Expression/ClangExpressionDeclMap.cpp
    lldb/branches/lldb-platform-work/source/Expression/ClangExpressionVariable.cpp
    lldb/branches/lldb-platform-work/source/Expression/ClangFunction.cpp
    lldb/branches/lldb-platform-work/source/Expression/ClangUserExpression.cpp
    lldb/branches/lldb-platform-work/source/Expression/DWARFExpression.cpp
    lldb/branches/lldb-platform-work/source/Expression/ExpressionSourceCode.cpp
    lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp
    lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp
    lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
    lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp
    lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp
    lldb/branches/lldb-platform-work/source/Host/linux/Host.cpp
    lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm
    lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
    lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
    lldb/branches/lldb-platform-work/source/Interpreter/PythonDataObjects.cpp
    lldb/branches/lldb-platform-work/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
    lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
    lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
    lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
    lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
    lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
    lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Makefile
    lldb/branches/lldb-platform-work/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
    lldb/branches/lldb-platform-work/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/CMakeLists.txt
    lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessLinux.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessLinux.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
    lldb/branches/lldb-platform-work/source/Symbol/CMakeLists.txt
    lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp
    lldb/branches/lldb-platform-work/source/Symbol/ClangASTImporter.cpp
    lldb/branches/lldb-platform-work/source/Symbol/ClangASTType.cpp
    lldb/branches/lldb-platform-work/source/Symbol/Function.cpp
    lldb/branches/lldb-platform-work/source/Symbol/ObjectFile.cpp
    lldb/branches/lldb-platform-work/source/Symbol/Symbol.cpp
    lldb/branches/lldb-platform-work/source/Symbol/SymbolFile.cpp
    lldb/branches/lldb-platform-work/source/Symbol/SymbolVendor.cpp
    lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp
    lldb/branches/lldb-platform-work/source/Symbol/Type.cpp
    lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp
    lldb/branches/lldb-platform-work/source/Symbol/Variable.cpp
    lldb/branches/lldb-platform-work/source/Target/ObjCLanguageRuntime.cpp
    lldb/branches/lldb-platform-work/source/Target/StackFrame.cpp
    lldb/branches/lldb-platform-work/source/Target/TargetList.cpp
    lldb/branches/lldb-platform-work/source/Target/Thread.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOut.cpp
    lldb/branches/lldb-platform-work/source/Target/ThreadPlanTracer.cpp
    lldb/branches/lldb-platform-work/source/lldb.cpp
    lldb/branches/lldb-platform-work/test/dotest.py
    lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/Makefile
    lldb/branches/lldb-platform-work/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
    lldb/branches/lldb-platform-work/test/functionalities/inline-stepping/TestInlineStepping.py
    lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py
    lldb/branches/lldb-platform-work/test/functionalities/register/main.cpp
    lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
    lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
    lldb/branches/lldb-platform-work/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
    lldb/branches/lldb-platform-work/test/lldbtest.py
    lldb/branches/lldb-platform-work/test/lldbutil.py
    lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c
    lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj
    lldb/branches/lldb-platform-work/tools/debugserver/source/DNBArch.h
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
    lldb/branches/lldb-platform-work/www/formats.html
    lldb/branches/lldb-platform-work/www/python-reference.html
    lldb/branches/lldb-platform-work/www/troubleshooting.html

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 17 17:17:41 2013
@@ -1,2 +1,2 @@
 /lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:154223-185480
+/lldb/trunk:154223-186537

Modified: lldb/branches/lldb-platform-work/examples/python/cmdtemplate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/cmdtemplate.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/cmdtemplate.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/cmdtemplate.py Wed Jul 17 17:17:41 2013
@@ -38,8 +38,8 @@ def the_framestats_command(debugger, com
     except:
         # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
         # (courtesy of OptParse dealing with argument errors by throwing SystemExit)
-        result.SetStatus (lldb.eReturnStatusFailed)
-        return "option parsing failed" # returning a string is the same as returning an error whose description is the string
+        result.SetError ("option parsing failed")
+        return
     
     # in a command - the lldb.* convenience variables are not to be used
     # and their values (if any) are undefined
@@ -54,7 +54,7 @@ def the_framestats_command(debugger, com
     variables_list = frame.GetVariables(options.arguments, options.locals, options.statics, options.inscope)
     variables_count = variables_list.GetSize()
     if variables_count == 0:
-        result.PutCString("no variables here")
+        print >> result, "no variables here"
         return
     total_size = 0
     for i in range(0,variables_count):
@@ -62,8 +62,8 @@ def the_framestats_command(debugger, com
         variable_type = variable.GetType()
         total_size = total_size + variable_type.GetByteSize()
     average_size = float(total_size) / variables_count
-    result.PutCString("Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (variables_count,total_size,average_size))
-    # not returning anything is askin to returning success
+    print >>result, "Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (variables_count,total_size,average_size)
+    # not returning anything is akin to returning success
 
 def __lldb_init_module (debugger, dict):
     # This initializer is being run from LLDB in the embedded command interpreter    

Modified: lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py Wed Jul 17 17:17:41 2013
@@ -69,10 +69,12 @@ def simple_backtrace(debugger):
   module_list = []
   address_list = [cur_thread.GetFrameAtIndex(0).GetPC()]
   this_module = backtrace_print_frame (target, 0, cur_thread.GetFrameAtIndex(0).GetPC(), initial_fp)
+  print_stack_frame (process, initial_fp)
+  print ""
   if this_module != None:
     module_list.append (this_module)
   if cur_thread.GetNumFrames() < 2:
-    return
+    return [module_list, address_list]
 
   cur_fp = process.ReadPointerFromMemory (initial_fp, lldb.SBError())
   cur_pc = process.ReadPointerFromMemory (initial_fp + process.GetAddressByteSize(), lldb.SBError())
@@ -82,6 +84,8 @@ def simple_backtrace(debugger):
   while cur_pc != 0 and cur_fp != 0 and cur_pc != lldb.LLDB_INVALID_ADDRESS and cur_fp != lldb.LLDB_INVALID_ADDRESS:
     address_list.append (cur_pc)
     this_module = backtrace_print_frame (target, frame_num, cur_pc, cur_fp)
+    print_stack_frame (process, cur_fp)
+    print ""
     if this_module != None:
       module_list.append (this_module)
     frame_num = frame_num + 1
@@ -101,10 +105,29 @@ def simple_backtrace(debugger):
     cur_pc = next_pc
     cur_fp = next_fp
   this_module = backtrace_print_frame (target, frame_num, cur_pc, cur_fp)
+  print_stack_frame (process, cur_fp)
+  print ""
   if this_module != None:
     module_list.append (this_module)
   return [module_list, address_list]
 
+def print_stack_frame(process, fp):
+  if fp == 0 or fp == lldb.LLDB_INVALID_ADDRESS or fp == 1:
+    return
+  addr_size = process.GetAddressByteSize()
+  addr = fp - (2 * addr_size)
+  i = 0
+  outline = "Stack frame from $fp-%d: " % (2 * addr_size)
+  error = lldb.SBError()
+  try:
+    while i < 5 and error.Success():
+      address = process.ReadPointerFromMemory(addr + (i * addr_size), error)
+      outline += " 0x%x" % address
+      i += 1
+    print outline
+  except Exception:
+    return
+
 def diagnose_unwind(debugger, command, result, dict):
   """
 Gather diagnostic information to help debug incorrect unwind (backtrace) 
@@ -157,6 +180,8 @@ to be helpful when reporting the problem
         for frame in thread.frames:
           if not frame.IsInlined():
             this_module = backtrace_print_frame (target, frame_num, frame.GetPC(), frame.GetFP())
+            print_stack_frame (process, frame.GetFP())
+            print ""
             if this_module != None:
               modules_seen.append (this_module)
             addresses_seen.append (frame.GetPC())
@@ -166,10 +191,12 @@ to be helpful when reporting the problem
         print ""
         print "Simple stack walk algorithm:"
         print ""
-        simple_bt_modules_and_addresses = simple_backtrace(debugger)
-        modules_seen += simple_bt_modules_and_addresses[0]
-        addresses_seen = set(addresses_seen)
-        addresses_seen.update(set(simple_bt_modules_and_addresses[1]))
+        (module_list, address_list) = simple_backtrace(debugger)
+        if module_list and module_list != None:
+          modules_seen += module_list
+        if address_list and address_list != None:
+          addresses_seen = set(addresses_seen)
+          addresses_seen.update(set(address_list))
 
         print ""
         print "============================================================================================="

Modified: lldb/branches/lldb-platform-work/examples/python/types.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/types.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/types.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/types.py Wed Jul 17 17:17:41 2013
@@ -13,6 +13,7 @@ import commands
 import platform
 import os
 import re
+import signal
 import sys
 
 try: 
@@ -227,6 +228,10 @@ if __name__ == '__main__':
     #     print "error: option parsing failed" 
     #     sys.exit(1)
     
+    if options.debug:
+        print "Waiting for debugger to attach to process %d" % os.getpid()
+        os.kill(os.getpid(), signal.SIGSTOP)
+        
     for path in args:
     # in a command - the lldb.* convenience variables are not to be used
     # and their values (if any) are undefined

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBDefines.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBDefines.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBDefines.h Wed Jul 17 17:17:41 2013
@@ -54,6 +54,8 @@ class SBInstructionList;
 class SBLineEntry;
 class SBListener;
 class SBModule;
+class SBModuleSpec;
+class SBModuleSpecList;
 class SBProcess;
 class SBSourceManager;
 class SBStream;

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBFileSpec.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBFileSpec.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBFileSpec.h Wed Jul 17 17:17:41 2013
@@ -64,13 +64,16 @@ private:
     friend class SBLaunchInfo;
     friend class SBLineEntry;
     friend class SBModule;
+    friend class SBModuleSpec;
     friend class SBProcess;
     friend class SBSourceManager;
     friend class SBThread;
     friend class SBTarget;
 
+    SBFileSpec (const lldb_private::FileSpec& fspec);
+
     void
-    SetFileSpec (const lldb_private::FileSpec& fs);
+    SetFileSpec (const lldb_private::FileSpec& fspec);
 
     const lldb_private::FileSpec *
     operator->() const;

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h Wed Jul 17 17:17:41 2013
@@ -26,6 +26,8 @@ public:
 
     SBModule (const SBModule &rhs);
 
+    SBModule (const SBModuleSpec &module_spec);
+
     const SBModule &
     operator = (const SBModule &rhs);
 

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBStream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBStream.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBStream.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBStream.h Wed Jul 17 17:17:41 2013
@@ -75,6 +75,8 @@ protected:
     friend class SBInstructionList;
     friend class SBLineEntry;
     friend class SBModule;
+    friend class SBModuleSpec;
+    friend class SBModuleSpecList;
     friend class SBProcess;
     friend class SBSection;
     friend class SBSourceManager;

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h Wed Jul 17 17:17:41 2013
@@ -477,6 +477,10 @@ public:
                const char *triple,
                const char *uuid_cstr,
                const char *symfile);
+    
+    lldb::SBModule
+    AddModule (const SBModuleSpec &module_spec);
+
     uint32_t
     GetNumModules () const;
 

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBType.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBType.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBType.h Wed Jul 17 17:17:41 2013
@@ -164,10 +164,6 @@ public:
     bool
     IsTypeComplete ();
 
-    // DEPRECATED: but needed for Xcode right now
-    static bool
-    IsPointerType (void * clang_type);
-        
     bool
     GetDescription (lldb::SBStream &description, 
                     lldb::DescriptionLevel description_level);

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/DataBufferHeap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/DataBufferHeap.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/DataBufferHeap.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/DataBufferHeap.h Wed Jul 17 17:17:41 2013
@@ -121,6 +121,9 @@ public:
     void
     CopyData (const void *src, lldb::offset_t src_len);
 
+    void
+    Clear();
+
 private:
     //------------------------------------------------------------------
     // This object uses a std::vector<uint8_t> to store its data. This

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Module.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Module.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Module.h Wed Jul 17 17:17:41 2013
@@ -651,8 +651,8 @@ public:
     ///     Unified module section list.
     //------------------------------------------------------------------
     virtual SectionList *
-    GetUnifiedSectionList ();
- 
+    GetSectionList ();
+
     uint32_t
     GetVersion (uint32_t *versions, uint32_t num_versions);
 
@@ -1000,7 +1000,7 @@ protected:
     std::unique_ptr<SymbolVendor> m_symfile_ap;   ///< A pointer to the symbol vendor for this module.
     ClangASTContext             m_ast;          ///< The AST context for this module.
     PathMappingList             m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
-    std::unique_ptr<lldb_private::SectionList> m_unified_sections_ap; ///< Unified section list for module.
+    std::unique_ptr<lldb_private::SectionList> m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
 
     bool                        m_did_load_objfile:1,
                                 m_did_load_symbol_vendor:1,
@@ -1059,9 +1059,12 @@ protected:
     bool
     SetArchitecture (const ArchSpec &new_arch);
     
-    
+    SectionList *
+    GetUnifiedSectionList();
+
     friend class ModuleList;
     friend class ObjectFile;
+    friend class SymbolFile;
 
 private:
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ModuleList.h Wed Jul 17 17:17:41 2013
@@ -270,6 +270,14 @@ public:
                    SymbolContextList &sc_list) const;
 
     //------------------------------------------------------------------
+    /// @see Module::FindFunctionSymbols ()
+    //------------------------------------------------------------------
+    size_t
+    FindFunctionSymbols (const ConstString &name,
+                         uint32_t name_type_mask,
+                         SymbolContextList& sc_list);
+
+    //------------------------------------------------------------------
     /// Find global and static variables by name.
     ///
     /// @param[in] name

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ModuleSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ModuleSpec.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ModuleSpec.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ModuleSpec.h Wed Jul 17 17:17:41 2013
@@ -11,6 +11,7 @@
 #define liblldb_ModuleSpec_h_
 
 #include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/Stream.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Target/PathMappingList.h"
@@ -286,6 +287,136 @@ public:
         m_object_mod_time.Clear();
     }
 
+    
+    operator bool () const
+    {
+        if (m_file)
+            return true;
+        if (m_platform_file)
+            return true;
+        if (m_symbol_file)
+            return true;
+        if (m_arch.IsValid())
+            return true;
+        if (m_uuid.IsValid())
+            return true;
+        if (m_object_name)
+            return true;
+        if (m_object_mod_time.IsValid())
+            return true;
+        return false;
+    }
+
+    void
+    Dump (Stream &strm)
+    {
+        bool dumped_something = false;
+        if (m_file)
+        {
+            strm.PutCString("file = '");
+            strm << m_file;
+            strm.PutCString("'");
+            dumped_something = true;
+        }
+        if (m_platform_file)
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.PutCString("platform_file = '");
+            strm << m_platform_file;
+            strm.PutCString("'");
+            dumped_something = true;
+        }
+        if (m_symbol_file)
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.PutCString("symbol_file = '");
+            strm << m_symbol_file;
+            strm.PutCString("'");
+            dumped_something = true;
+        }
+        if (m_arch.IsValid())
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.Printf("arch = %s", m_arch.GetTriple().str().c_str());
+            dumped_something = true;
+        }
+        if (m_uuid.IsValid())
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.PutCString("uuid = ");
+            m_uuid.Dump(&strm);
+            dumped_something = true;
+        }
+        if (m_object_name)
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.Printf("object_name = %s", m_object_name.GetCString());
+            dumped_something = true;
+        }
+        if (m_object_offset > 0)
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.Printf("object_offset = 0x%" PRIx64, m_object_offset);
+            dumped_something = true;
+        }
+        if (m_object_mod_time.IsValid())
+        {
+            if (dumped_something)
+                strm.PutCString(", ");
+            strm.Printf("object_mod_time = 0x%" PRIx64, m_object_mod_time.GetAsSecondsSinceJan1_1970());
+            dumped_something = true;
+        }
+    }
+
+    bool
+    Matches (const ModuleSpec &match_module_spec, bool exact_arch_match) const
+    {
+        if (match_module_spec.GetUUIDPtr() && match_module_spec.GetUUID() != GetUUID())
+            return false;
+        if (match_module_spec.GetObjectName() && match_module_spec.GetObjectName() != GetObjectName())
+            return false;
+        if (match_module_spec.GetFileSpecPtr())
+        {
+            const FileSpec &fspec = match_module_spec.GetFileSpec();
+            if (!FileSpec::Equal(fspec, GetFileSpec(), fspec.GetDirectory().IsEmpty() == false))
+                return false;
+        }
+        if (match_module_spec.GetPlatformFileSpecPtr())
+        {
+            const FileSpec &fspec = match_module_spec.GetPlatformFileSpec();
+            if (!FileSpec::Equal(fspec, GetPlatformFileSpec(), fspec.GetDirectory().IsEmpty() == false))
+                return false;
+            
+        }
+        if (match_module_spec.GetSymbolFileSpecPtr())
+        {
+            const FileSpec &fspec = match_module_spec.GetSymbolFileSpec();
+            if (!FileSpec::Equal(fspec, GetSymbolFileSpec(), fspec.GetDirectory().IsEmpty() == false))
+                return false;
+            
+        }
+        if (match_module_spec.GetArchitecturePtr())
+        {
+            if (exact_arch_match)
+            {
+                if (!GetArchitecture().IsExactMatch(match_module_spec.GetArchitecture()))
+                    return false;
+            }
+            else
+            {
+                if (!GetArchitecture().IsCompatibleMatch(match_module_spec.GetArchitecture()))
+                    return false;
+            }
+        }
+        return true;
+    }
+
 protected:
     FileSpec m_file;
     FileSpec m_platform_file;
@@ -319,7 +450,19 @@ public:
     ~ModuleSpecList ()
     {
     }
-    
+
+    ModuleSpecList &
+    operator = (const ModuleSpecList &rhs)
+    {
+        if (this != &rhs)
+        {
+            Mutex::Locker lhs_locker(m_mutex);
+            Mutex::Locker rhs_locker(rhs.m_mutex);
+            m_specs = rhs.m_specs;
+        }
+        return *this;
+    }
+
     size_t
     GetSize() const
     {
@@ -340,7 +483,22 @@ public:
         Mutex::Locker locker(m_mutex);
         m_specs.push_back (spec);
     }
-    
+
+    void
+    Append (const ModuleSpecList &rhs)
+    {
+        Mutex::Locker lhs_locker(m_mutex);
+        Mutex::Locker rhs_locker(rhs.m_mutex);
+        m_specs.insert(m_specs.end(), rhs.m_specs.begin(), rhs.m_specs.end());
+    }
+
+    // The index "i" must be valid and this can't be used in
+    // multi-threaded code as no mutex lock is taken.
+    ModuleSpec &
+    GetModuleSpecRefAtIndex (size_t i)
+    {
+        return m_specs[i];
+    }
     bool
     GetModuleSpecAtIndex (size_t i, ModuleSpec &module_spec) const
     {
@@ -354,58 +512,76 @@ public:
         return false;
     }
     
+    
     bool
     FindMatchingModuleSpec (const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
     {
-        const FileSpec *file_ptr = module_spec.GetFileSpecPtr();
-        const FileSpec *platform_file_ptr = module_spec.GetPlatformFileSpecPtr();
-        const FileSpec *symbol_file_ptr = module_spec.GetSymbolFileSpecPtr();
-        const ArchSpec *arch_ptr = module_spec.GetArchitecturePtr();
-        const UUID *uuid_ptr = module_spec.GetUUIDPtr();
-        const bool check_module_name = (bool)module_spec.GetObjectName();
         Mutex::Locker locker(m_mutex);
+        bool exact_arch_match = true;
         for (auto spec: m_specs)
         {
-            if (uuid_ptr && spec.GetUUID() != *uuid_ptr)
-                continue;
-            if (check_module_name && module_spec.GetObjectName() != spec.GetObjectName())
-                continue;
-            if (file_ptr && !FileSpec::Equal(*file_ptr, spec.GetFileSpec(), file_ptr->GetDirectory().IsEmpty() == false))
-                continue;
-            if (platform_file_ptr && !FileSpec::Equal(*platform_file_ptr, spec.GetFileSpec(), platform_file_ptr->GetDirectory().IsEmpty() == false))
-                continue;
-            if (symbol_file_ptr && !FileSpec::Equal(*symbol_file_ptr, spec.GetFileSpec(), symbol_file_ptr->GetDirectory().IsEmpty() == false))
-                continue;
-            if (arch_ptr && !spec.GetArchitecture().IsExactMatch(*arch_ptr))
-                continue;
-            match_module_spec = spec;
-            return true;
+            if (spec.Matches(module_spec, exact_arch_match))
+            {
+                match_module_spec = spec;
+                return true;
+            }
         }
         
         // If there was an architecture, retry with a compatible arch
-        if (arch_ptr)
+        if (module_spec.GetArchitecturePtr())
         {
+            exact_arch_match = false;
             for (auto spec: m_specs)
             {
-                if (uuid_ptr && spec.GetUUID() != *uuid_ptr)
-                    continue;
-                if (check_module_name && module_spec.GetObjectName() != spec.GetObjectName())
-                    continue;
-                if (file_ptr && !FileSpec::Equal(*file_ptr, spec.GetFileSpec(), file_ptr->GetDirectory().IsEmpty() == false))
-                    continue;
-                if (platform_file_ptr && !FileSpec::Equal(*platform_file_ptr, spec.GetFileSpec(), platform_file_ptr->GetDirectory().IsEmpty() == false))
-                    continue;
-                if (symbol_file_ptr && !FileSpec::Equal(*symbol_file_ptr, spec.GetFileSpec(), symbol_file_ptr->GetDirectory().IsEmpty() == false))
-                    continue;
-                if (arch_ptr && !spec.GetArchitecture().IsCompatibleMatch(*arch_ptr))
-                    continue;
-                match_module_spec = spec;
-                return true;
+                if (spec.Matches(module_spec, exact_arch_match))
+                {
+                    match_module_spec = spec;
+                    return true;
+                }
             }
         }
         match_module_spec.Clear();
         return false;
     }
+    
+    size_t
+    FindMatchingModuleSpecs (const ModuleSpec &module_spec, ModuleSpecList &matching_list) const
+    {
+        Mutex::Locker locker(m_mutex);
+        bool exact_arch_match = true;
+        const size_t initial_match_count = matching_list.GetSize();
+        for (auto spec: m_specs)
+        {
+            if (spec.Matches(module_spec, exact_arch_match))
+                matching_list.Append (spec);
+        }
+        
+        // If there was an architecture, retry with a compatible arch if no matches were found
+        if (module_spec.GetArchitecturePtr() && (initial_match_count == matching_list.GetSize()))
+        {
+            exact_arch_match = false;
+            for (auto spec: m_specs)
+            {
+                if (spec.Matches(module_spec, exact_arch_match))
+                    matching_list.Append (spec);
+            }
+        }
+        return matching_list.GetSize() - initial_match_count;
+    }
+
+    void
+    Dump (Stream &strm)
+    {
+        Mutex::Locker locker(m_mutex);
+        uint32_t idx = 0;
+        for (auto spec: m_specs)
+        {
+            strm.Printf("[%u] ", idx);
+            spec.Dump (strm);
+            strm.EOL();
+            ++idx;
+        }
+    }
 
 protected:
     typedef std::vector<ModuleSpec> collection; ///< The module collection type.

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/PluginManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/PluginManager.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/PluginManager.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/PluginManager.h Wed Jul 17 17:17:41 2013
@@ -234,7 +234,8 @@ public:
     static bool
     RegisterPlugin (const ConstString &name,
                     const char *description,
-                    ProcessCreateInstance create_callback);
+                    ProcessCreateInstance create_callback,
+                    DebuggerInitializeCallback debugger_init_callback = NULL);
     
     static bool
     UnregisterPlugin (ProcessCreateInstance create_callback);
@@ -315,7 +316,7 @@ public:
     
     static lldb::OptionValuePropertiesSP
     GetSettingForDynamicLoaderPlugin (Debugger &debugger,
-                                       const ConstString &setting_name);
+                                      const ConstString &setting_name);
     
     static bool
     CreateSettingForDynamicLoaderPlugin (Debugger &debugger,
@@ -332,6 +333,17 @@ public:
                                          const lldb::OptionValuePropertiesSP &properties_sp,
                                          const ConstString &description,
                                          bool is_global_property);
+
+    static lldb::OptionValuePropertiesSP
+    GetSettingForProcessPlugin (Debugger &debugger,
+                                const ConstString &setting_name);
+    
+    static bool
+    CreateSettingForProcessPlugin (Debugger &debugger,
+                                   const lldb::OptionValuePropertiesSP &properties_sp,
+                                   const ConstString &description,
+                                   bool is_global_property);
+
 };
 
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/RangeMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/RangeMap.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/RangeMap.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/RangeMap.h Wed Jul 17 17:17:41 2013
@@ -1138,6 +1138,39 @@ namespace lldb_private {
             }
         }
         
+        // Calculate the byte size of ranges with zero byte sizes by finding
+        // the next entry with a base address > the current base address
+        void
+        CalculateSizesOfZeroByteSizeRanges ()
+        {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+            assert (IsSorted());
+#endif
+            typename Collection::iterator pos;
+            typename Collection::iterator end;
+            typename Collection::iterator next;
+            for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos)
+            {
+                if (pos->GetByteSize() == 0)
+                {
+                    // Watch out for multiple entries with same address and make sure
+                    // we find an entry that is greater than the current base address
+                    // before we use that for the size
+                    auto curr_base = pos->GetRangeBase();
+                    for (next = pos + 1; next != end; ++next)
+                    {
+                        auto next_base = next->GetRangeBase();
+                        if (next_base > curr_base)
+                        {
+                            pos->SetByteSize (next_base - curr_base);
+                            break;
+                        }
+                    }
+                }
+            }
+            
+        }
+        
         void
         Clear ()
         {

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Section.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Section.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Section.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Section.h Wed Jul 17 17:17:41 2013
@@ -34,8 +34,8 @@ public:
 
     ~SectionList();
 
-    bool
-    Copy (SectionList* dest_section_list);
+    SectionList &
+    operator =(const SectionList& rhs);
 
     size_t
     AddSection (const lldb::SectionSP& section_sp);
@@ -91,17 +91,6 @@ public:
     size_t
     Slide (lldb::addr_t slide_amount, bool slide_children);
     
-    // Update all section lookup caches
-    void
-    Finalize ();
-
-    // Each time Finalize() is called with changes, revision id increments.
-    uint32_t
-    GetRevisionID() const
-    {
-        return m_revision_id;
-    }
-
     void
     Clear ()
     {
@@ -109,8 +98,6 @@ public:
     }
 
 protected:
-    bool        m_changed;
-    uint32_t    m_revision_id;
     collection  m_sections;
 };
 
@@ -283,13 +270,6 @@ public:
         m_thread_specific = b;
     }
     
-    // Update all section lookup caches
-    void
-    Finalize ()
-    {
-        m_children.Finalize();
-    }
-
     ObjectFile *
     GetObjectFile ()
     {

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h Wed Jul 17 17:17:41 2013
@@ -52,7 +52,7 @@ public:
     bool
     IsValid () const;
 
-    void
+    bool
     SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16);
 
     std::string

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Value.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Value.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Value.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Value.h Wed Jul 17 17:17:41 2013
@@ -21,6 +21,7 @@
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Scalar.h"
+#include "lldb/Symbol/ClangASTType.h"
 
 namespace lldb_private {
 
@@ -46,7 +47,6 @@ public:
                                         // m_context contains...
                                         // ====================
         eContextTypeInvalid,            // undefined
-        eContextTypeClangType,          // void * (an opaque clang::QualType * that can be fed to "static QualType QualType::getFromOpaquePtr(void *)")
         eContextTypeRegisterInfo,       // RegisterInfo * (can be a scalar or a vector register)
         eContextTypeLLDBType,           // lldb_private::Type *
         eContextTypeVariable            // lldb_private::Variable *
@@ -77,7 +77,13 @@ public:
             return *this;
         }
 
-        bool 
+        void
+        Clear ()
+        {
+			length = 0;
+        }
+
+        bool
 		SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
 		{
             this->length = length;
@@ -124,8 +130,11 @@ public:
     Value &
     operator=(const Value &rhs);
 
-    lldb::clang_type_t
+    const ClangASTType &
     GetClangType();
+    
+    void
+    SetClangType (const ClangASTType &clang_type);
 
     ValueType
     GetValueType() const;
@@ -173,7 +182,7 @@ public:
     GetType();
 
     Scalar &
-    ResolveValue (ExecutionContext *exe_ctx, clang::ASTContext *ast_context);
+    ResolveValue (ExecutionContext *exe_ctx);
 
     const Scalar &
     GetScalar() const
@@ -227,7 +236,7 @@ public:
     ResizeData(size_t len);
 
     bool
-    ValueOf(ExecutionContext *exe_ctx, clang::ASTContext *ast_context);
+    ValueOf(ExecutionContext *exe_ctx);
 
     Variable *
     GetVariable();
@@ -239,11 +248,10 @@ public:
     GetValueDefaultFormat ();
 
     uint64_t
-    GetValueByteSize (clang::ASTContext *ast_context, Error *error_ptr);
+    GetValueByteSize (Error *error_ptr);
 
     Error
     GetValueAsData (ExecutionContext *exe_ctx, 
-                    clang::ASTContext *ast_context, 
                     DataExtractor &data, 
                     uint32_t data_offset,
                     Module *module);     // Can be NULL
@@ -257,11 +265,15 @@ public:
     bool
     GetData (DataExtractor &data);
 
+    void
+    Clear();
+
 protected:
     Scalar          m_value;
     Vector          m_vector;
-    ValueType       m_value_type;
+    ClangASTType    m_clang_type;
     void *          m_context;
+    ValueType       m_value_type;
     ContextType     m_context_type;
     DataBufferHeap  m_data_buffer;
 };

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h Wed Jul 17 17:17:41 2013
@@ -596,10 +596,7 @@ public:
     
     virtual ~ValueObject();
     
-    clang::ASTContext *
-    GetClangAST ();
-    
-    lldb::clang_type_t
+    ClangASTType
     GetClangType ();
 
     //------------------------------------------------------------------
@@ -624,7 +621,7 @@ public:
     GetObjectRuntimeLanguage();
 
     virtual uint32_t
-    GetTypeInfo (lldb::clang_type_t *pointee_or_element_clang_type = NULL);
+    GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL);
 
     virtual bool
     IsPointerType ();
@@ -718,12 +715,6 @@ public:
         return m_is_array_item_for_pointer;
     }
     
-    virtual bool
-    SetClangAST (clang::ASTContext *ast)
-    {
-        return false;
-    }
-
     virtual const char *
     GetValueAsCString ();
     
@@ -1337,10 +1328,7 @@ protected:
     // Sublasses must implement the functions below.
     //------------------------------------------------------------------
     
-    virtual clang::ASTContext *
-    GetClangASTImpl () = 0;
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl () = 0;
     
     const char *

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectCast.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectCast.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectCast.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectCast.h Wed Jul 17 17:17:41 2013
@@ -66,10 +66,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
     
     ClangASTType m_cast_type;

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectChild.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectChild.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectChild.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectChild.h Wed Jul 17 17:17:41 2013
@@ -81,20 +81,13 @@ protected:
     virtual bool
     UpdateValue ();
 
-    virtual clang::ASTContext *
-    GetClangASTImpl ()
-    {
-        return m_clang_ast;
-    }
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ()
     {
         return m_clang_type;
     }
     
-    clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from
-    void *m_clang_type; // The type of the child in question within the parent (m_parent_sp)
+    ClangASTType m_clang_type;
     ConstString m_type_name;
     uint64_t m_byte_size;
     int32_t m_byte_offset;
@@ -111,8 +104,7 @@ protected:
     friend class ValueObject;
     friend class ValueObjectConstResult;
     ValueObjectChild (ValueObject &parent,
-                      clang::ASTContext *clang_ast,
-                      void *clang_type,
+                      const ClangASTType &clang_type,
                       const ConstString &name,
                       uint64_t byte_size,
                       int32_t byte_offset,

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResult.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResult.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResult.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResult.h Wed Jul 17 17:17:41 2013
@@ -34,16 +34,14 @@ public:
 
     static lldb::ValueObjectSP
     Create (ExecutionContextScope *exe_scope,
-            clang::ASTContext *clang_ast,
-            void *clang_type,
+            const ClangASTType &clang_type,
             const ConstString &name,
             const DataExtractor &data,
             lldb::addr_t address = LLDB_INVALID_ADDRESS);
 
     static lldb::ValueObjectSP
     Create (ExecutionContextScope *exe_scope,
-            clang::ASTContext *clang_ast,
-            void *clang_type,
+            const ClangASTType &clang_type,
             const ConstString &name,
             const lldb::DataBufferSP &result_data_sp,
             lldb::ByteOrder byte_order, 
@@ -52,8 +50,7 @@ public:
 
     static lldb::ValueObjectSP
     Create (ExecutionContextScope *exe_scope,
-            clang::ASTContext *clang_ast,
-            void *clang_type,
+            const ClangASTType &clang_type,
             const ConstString &name,
             lldb::addr_t address,
             AddressType address_type,
@@ -61,7 +58,6 @@ public:
 
     static lldb::ValueObjectSP
     Create (ExecutionContextScope *exe_scope,
-            clang::ASTContext *clang_ast,
             Value &value,
             const ConstString &name);
 
@@ -87,13 +83,6 @@ public:
     virtual bool
     IsInScope ();
 
-    virtual bool
-    SetClangAST (clang::ASTContext *ast)
-    {
-        m_clang_ast = ast;
-        return true;
-    }
-
     void
     SetByteSize (size_t size);
     
@@ -139,13 +128,9 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
-    clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from
     ConstString m_type_name;
     uint64_t m_byte_size;
     
@@ -159,15 +144,13 @@ private:
                             lldb::addr_t address);
 
     ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                            clang::ASTContext *clang_ast,
-                            void *clang_type,
+                            const ClangASTType &clang_type,
                             const ConstString &name,
                             const DataExtractor &data,
                             lldb::addr_t address);
 
     ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                            clang::ASTContext *clang_ast,
-                            void *clang_type,
+                            const ClangASTType &clang_type,
                             const ConstString &name,
                             const lldb::DataBufferSP &result_data_sp,
                             lldb::ByteOrder byte_order, 
@@ -175,15 +158,13 @@ private:
                             lldb::addr_t address);
 
     ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                            clang::ASTContext *clang_ast,
-                            void *clang_type,
+                            const ClangASTType &clang_type,
                             const ConstString &name,
                             lldb::addr_t address,
                             AddressType address_type,
                             uint32_t addr_byte_size);
 
     ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                            clang::ASTContext *clang_ast,
                             const Value &value,
                             const ConstString &name);
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResultChild.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResultChild.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResultChild.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectConstResultChild.h Wed Jul 17 17:17:41 2013
@@ -27,8 +27,7 @@ class ValueObjectConstResultChild : publ
 public:
     
     ValueObjectConstResultChild (ValueObject &parent,
-                                 clang::ASTContext *clang_ast,
-                                 void *clang_type,
+                                 const ClangASTType &clang_type,
                                  const ConstString &name,
                                  uint32_t byte_size,
                                  int32_t byte_offset,
@@ -45,7 +44,7 @@ public:
     virtual ValueObject *
     CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
 
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangType ()
     {
         return ValueObjectChild::GetClangType();

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectDynamicValue.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectDynamicValue.h Wed Jul 17 17:17:41 2013
@@ -109,10 +109,7 @@ protected:
         return true;
     }
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
     Address  m_address;  ///< The variable that this value object is based upon

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectMemory.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectMemory.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectMemory.h Wed Jul 17 17:17:41 2013
@@ -63,10 +63,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
     Address  m_address;  ///< The variable that this value object is based upon

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectRegister.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectRegister.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectRegister.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectRegister.h Wed Jul 17 17:17:41 2013
@@ -56,10 +56,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
     lldb::RegisterContextSP m_reg_ctx_sp;
@@ -113,10 +110,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
     lldb::RegisterContextSP m_reg_ctx_sp;
@@ -173,17 +167,14 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
     lldb::RegisterContextSP m_reg_ctx_sp;
     RegisterInfo m_reg_info;
     RegisterValue m_reg_value;
     ConstString m_type_name;
-    void *m_clang_type;
+    ClangASTType m_clang_type;
 
 private:
     void

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectSyntheticFilter.h Wed Jul 17 17:17:41 2013
@@ -140,10 +140,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
     
     virtual void

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectVariable.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectVariable.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObjectVariable.h Wed Jul 17 17:17:41 2013
@@ -71,10 +71,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual clang::ASTContext *
-    GetClangASTImpl ();
-    
-    virtual lldb::clang_type_t
+    virtual ClangASTType
     GetClangTypeImpl ();
 
     lldb::VariableSP  m_variable_sp;  ///< The variable that this value object is based upon

Removed: lldb/branches/lldb-platform-work/include/lldb/Core/cxa_demangle.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/cxa_demangle.h?rev=186539&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/cxa_demangle.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/cxa_demangle.h (removed)
@@ -1,173 +0,0 @@
-//===-------------------------- cxa_demangle.h ----------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _CXA_DEMANGLE_H
-#define _CXA_DEMANGLE_H
-
-// FreeBSD9-STABLE fix (define size_t before including cxxabi.h)
-#include <cstdlib>
-#include <cxxabi.h>
-
-#pragma GCC visibility push(hidden)
-
-namespace lldb_cxxabiv1
-{
-
-namespace __libcxxabi
-{
-
-class __demangle_tree;
-class __node;
-
-char*
-__demangle(__demangle_tree, char*, size_t*, int*);
-
-struct __demangle_tree_rv
-{
-    __demangle_tree* ptr_;
-
-    explicit __demangle_tree_rv(__demangle_tree* ptr)
-        : ptr_(ptr) {}
-};
-
-class __demangle_tree
-{
-    const char* __mangled_name_begin_;
-    const char* __mangled_name_end_;
-    int         __status_;
-    __node*     __root_;
-    __node*     __node_begin_;
-    __node*     __node_end_;
-    __node*     __node_cap_;
-    __node**    __sub_begin_;
-    __node**    __sub_end_;
-    __node**    __sub_cap_;
-    __node**    __t_begin_;
-    __node**    __t_end_;
-    __node**    __t_cap_;
-    bool        __tag_templates_;
-    bool        __fix_forward_references_;
-    bool        __owns_buf_;
-
-    __demangle_tree& operator=(const __demangle_tree&);
-public:
-    __demangle_tree(const char*, char*, size_t);
-    ~__demangle_tree();
-
-    __demangle_tree(__demangle_tree&);
-    __demangle_tree(__demangle_tree_rv);
-    operator __demangle_tree_rv() {return __demangle_tree_rv(this);}
-
-    int __status() const;
-    size_t size() const;
-    char* __get_demangled_name(char*) const;
-
-    void __parse();
-
-private:
-    const char* __parse_encoding(const char*, const char*);
-    const char* __parse_type(const char*, const char*,
-                             bool = true, bool = false);
-    const char* __parse_special_name(const char*, const char*);
-    const char* __parse_name(const char*, const char*);
-    const char* __parse_bare_function_type(const char*, const char*);
-    const char* __parse_call_offset(const char*, const char*);
-    const char* __parse_number(const char*, const char*);
-    const char* __parse_cv_qualifiers(const char* first, const char* last,
-                                      unsigned& cv, bool = false);
-    const char* __parse_nested_name(const char*, const char*);
-    const char* __parse_discriminator(const char*, const char*);
-    const char* __parse_local_name(const char*, const char*);
-    const char* __parse_unscoped_template_name(const char*, const char*);
-    const char* __parse_unscoped_name(const char*, const char*);
-    const char* __parse_operator_name(const char*, const char*, int* = 0);
-    const char* __parse_unqualified_name(const char*, const char*);
-    const char* __parse_source_name(const char*, const char*);
-    const char* __parse_ctor_dtor_name(const char*, const char*);
-    const char* __parse_unnamed_type_name(const char*, const char*);
-    const char* __parse_template_args(const char*, const char*);
-    const char* __parse_template_arg(const char*, const char*);
-    const char* __parse_expression(const char*, const char*);
-    const char* __parse_expr_primary(const char*, const char*);
-    const char* __parse_substitution(const char*, const char*);
-    const char* __parse_builtin_type(const char*, const char*);
-    const char* __parse_function_type(const char*, const char*);
-    const char* __parse_class_enum_type(const char*, const char*);
-    const char* __parse_array_type(const char*, const char*);
-    const char* __parse_pointer_to_member_type(const char*, const char*);
-    const char* __parse_decltype(const char*, const char*);
-    const char* __parse_template_param(const char*, const char*);
-    const char* __parse_unresolved_name(const char*, const char*);
-    const char* __parse_unresolved_type(const char*, const char*);
-    const char* __parse_base_unresolved_name(const char*, const char*);
-    const char* __parse_simple_id(const char*, const char*);
-    const char* __parse_destructor_name(const char*, const char*);
-    const char* __parse_function_param(const char*, const char*);
-    const char* __parse_const_cast_expr(const char*, const char*);
-    const char* __parse_alignof_expr(const char*, const char*);
-    const char* __parse_call_expr(const char*, const char*);
-    const char* __parse_conversion_expr(const char*, const char*);
-    const char* __parse_delete_array_expr(const char*, const char*);
-    const char* __parse_delete_expr(const char*, const char*);
-    const char* __parse_dynamic_cast_expr(const char*, const char*);
-    const char* __parse_dot_star_expr(const char*, const char*);
-    const char* __parse_dot_expr(const char*, const char*);
-    const char* __parse_decrement_expr(const char*, const char*);
-    const char* __parse_new_expr(const char*, const char*);
-    const char* __parse_increment_expr(const char*, const char*);
-    const char* __parse_arrow_expr(const char*, const char*);
-    const char* __parse_reinterpret_cast_expr(const char*, const char*);
-    const char* __parse_static_cast_expr(const char*, const char*);
-    const char* __parse_sizeof_type_expr(const char*, const char*);
-    const char* __parse_sizeof_param_pack_expr(const char*, const char*);
-    const char* __parse_typeid_expr(const char*, const char*);
-    const char* __parse_throw_expr(const char*, const char*);
-    const char* __parse_pack_expansion(const char*, const char*);
-    const char* __parse_sizeof_function_param_pack_expr(const char*, const char*);
-    const char* __parse_dot_suffix(const char*, const char*);
-    const char* __parse_unresolved_qualifier_level(const char*, const char*);
-    const char* __parse_vector_type(const char*, const char*);
-    const char* __parse_hex_number(const char*, const char*, unsigned long long&);
-
-    template <class _Tp> bool __make();
-    template <class _Tp, class _A0> bool __make(_A0 __a0);
-    template <class _Tp, class _A0, class _A1> bool __make(_A0 __a0, _A1 __a1);
-    template <class _Tp, class _A0, class _A1, class _A2>
-        bool __make(_A0 __a0, _A1 __a1, _A2 __a2);
-    template <class _Tp, class _A0, class _A1, class _A2, class _A3>
-        bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3);
-    template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4>
-        bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4);
-    template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4,
-                         class _A5>
-        bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4, _A5 __a5);
-
-    friend
-    char*
-    __demangle(__demangle_tree, char*, size_t*, int*);
-
-};
-
-__demangle_tree
-__demangle(const char*);
-
-__demangle_tree
-__demangle(const char*, char*, size_t);
-
-}  // __libcxxabi
-
-char*
-__cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status);
-
-}  // lldb__cxxabiv1
-
-#pragma GCC visibility pop
-
-
-#endif  // _CXA_DEMANGLE_H

Modified: lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h Wed Jul 17 17:17:41 2013
@@ -288,8 +288,8 @@ public:
         uint32_t* why = NULL)
     {
         uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
-        clang::QualType type = clang::QualType::getFromOpaquePtr(valobj.GetClangType());
-        bool ret = Get(valobj, type, entry, use_dynamic, value);
+        ClangASTType ast_type(valobj.GetClangType());
+        bool ret = Get(valobj, ast_type, entry, use_dynamic, value);
         if (ret)
             entry = MapValueType(entry);
         else
@@ -523,29 +523,23 @@ protected:
     
     bool
     Get_Impl (ValueObject& valobj,
-              clang::QualType type,
+              ClangASTType clang_type,
               MapValueType& entry,
               lldb::DynamicValueType use_dynamic,
               uint32_t& reason)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
 
-        if (type.isNull())
+        if (!clang_type.IsValid())
         {
             if (log)
-                log->Printf("[Get_Impl] type is NULL, returning");
+                log->Printf("[Get_Impl] type is invalid, returning");
             return false;
         }
         
-        type.removeLocalConst(); type.removeLocalVolatile(); type.removeLocalRestrict();
-        const clang::Type* typePtr = type.getTypePtrOrNull();
-        if (!typePtr)
-        {
-            if (log)
-                log->Printf("[Get_Impl] type is NULL, returning");
-            return false;
-        }
-        ConstString typeName(ClangASTType::GetTypeNameForQualType(valobj.GetClangAST(), type).c_str());
+        clang_type = clang_type.RemoveFastQualifiers();
+
+        ConstString typeName(clang_type.GetConstTypeName());
         
         if (valobj.GetBitfieldBitSize() > 0)
         {
@@ -569,33 +563,30 @@ protected:
             log->Printf("[Get_Impl] no direct match");
         
         // strip pointers and references and see if that helps
-        if (typePtr->isReferenceType())
+        if (clang_type.IsReferenceType())
         {
             if (log)
                 log->Printf("[Get_Impl] stripping reference");
-            if (Get_Impl(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->SkipsReferences())
+            if (Get_Impl(valobj, clang_type.GetNonReferenceType(), entry, use_dynamic, reason) && !entry->SkipsReferences())
             {
                 reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
                 return true;
             }
         }
-        else if (typePtr->isPointerType())
+        else if (clang_type.IsPointerType())
         {
             if (log)
                 log->Printf("[Get_Impl] stripping pointer");
-            clang::QualType pointee = typePtr->getPointeeType();
-            if (Get_Impl(valobj, pointee, entry, use_dynamic, reason) && !entry->SkipsPointers())
+            if (Get_Impl(valobj, clang_type.GetPointeeType(), entry, use_dynamic, reason) && !entry->SkipsPointers())
             {
                 reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
                 return true;
             }
         }
         
-        bool canBeObjCDynamic = ClangASTContext::IsPossibleDynamicType (valobj.GetClangAST(),
-                                                                        type.getAsOpaquePtr(),
-                                                                        NULL,
-                                                                        false, // no C++
-                                                                        true); // yes ObjC
+        bool canBeObjCDynamic = valobj.GetClangType().IsPossibleDynamicType (NULL,
+                                                                             false, // no C++
+                                                                             true); // yes ObjC
         
         if (canBeObjCDynamic)
         {
@@ -611,8 +602,7 @@ protected:
             }
             if (log)
                 log->Printf("[Get_Impl] dynamic disabled or failed - stripping ObjC pointer");
-            clang::QualType pointee = typePtr->getPointeeType();
-            if (Get_Impl(valobj, pointee, entry, use_dynamic, reason) && !entry->SkipsPointers())
+            if (Get_Impl(valobj, clang_type.GetPointeeType(), entry, use_dynamic, reason) && !entry->SkipsPointers())
             {
                 reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
                 return true;
@@ -620,12 +610,11 @@ protected:
         }
         
         // try to strip typedef chains
-        const clang::TypedefType* type_tdef = type->getAs<clang::TypedefType>();
-        if (type_tdef)
+        if (clang_type.IsTypedefType())
         {
             if (log)
                 log->Printf("[Get_Impl] stripping typedef");
-            if ((Get_Impl(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->Cascades())
+            if ((Get_Impl(valobj, clang_type.GetTypedefedType(), entry, use_dynamic, reason)) && entry->Cascades())
             {
                 reason |= lldb_private::eFormatterChoiceCriterionNavigatedTypedefs;
                 return true;
@@ -639,40 +628,35 @@ protected:
     // we are separately passing in valobj and type because the valobj is fixed (and is used for ObjC discovery and bitfield size)
     // but the type can change (e.g. stripping pointers, ...)
     bool Get (ValueObject& valobj,
-              clang::QualType type,
+              ClangASTType clang_type,
               MapValueType& entry,
               lldb::DynamicValueType use_dynamic,
               uint32_t& reason)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
         
-        if (Get_Impl (valobj,type,entry,use_dynamic,reason))
+        if (Get_Impl (valobj, clang_type, entry, use_dynamic, reason))
             return true;
         
         // try going to the unqualified type
         do {
             if (log)
                 log->Printf("[Get] trying the unqualified type");
-            lldb::clang_type_t opaque_type = type.getAsOpaquePtr();
-            if (!opaque_type)
-            {
-                if (log)
-                    log->Printf("[Get] could not get the opaque_type");
+            if (!clang_type.IsValid())
                 break;
-            }
-            ClangASTType unqual_clang_ast_type = ClangASTType::GetFullyUnqualifiedType(valobj.GetClangAST(),opaque_type);
+
+            ClangASTType unqual_clang_ast_type = clang_type.GetFullyUnqualifiedType();
             if (!unqual_clang_ast_type.IsValid())
             {
                 if (log)
                     log->Printf("[Get] could not get the unqual_clang_ast_type");
                 break;
             }
-            clang::QualType unqualified_qual_type = clang::QualType::getFromOpaquePtr(unqual_clang_ast_type.GetOpaqueQualType());
-            if (unqualified_qual_type.getTypePtrOrNull() != type.getTypePtrOrNull())
+            if (unqual_clang_ast_type.GetOpaqueQualType() != clang_type.GetOpaqueQualType())
             {
                 if (log)
                     log->Printf("[Get] unqualified type is there and is not the same, let's try");
-                if (Get_Impl (valobj,unqualified_qual_type,entry,use_dynamic,reason))
+                if (Get_Impl (valobj, unqual_clang_ast_type,entry, use_dynamic, reason))
                     return true;
             }
             else if (log)
@@ -689,7 +673,7 @@ protected:
             {
                 if (log)
                     log->Printf("[Get] has a static value - actually use it");
-                if (Get(*static_value_sp.get(), clang::QualType::getFromOpaquePtr(static_value_sp->GetClangType()) , entry, use_dynamic, reason))
+                if (Get(*static_value_sp.get(), static_value_sp->GetClangType(), entry, use_dynamic, reason))
                 {
                     reason |= lldb_private::eFormatterChoiceCriterionWentToStaticValue;
                     return true;

Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/ASTDumper.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/ASTDumper.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/ASTDumper.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/ASTDumper.h Wed Jul 17 17:17:41 2013
@@ -28,6 +28,7 @@ public:
     ASTDumper (const clang::Type *type);
     ASTDumper (clang::QualType type);
     ASTDumper (lldb::clang_type_t type);
+    ASTDumper (const ClangASTType &clang_type);
     
     const char *GetCString();
     void ToSTDERR();

Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/ClangASTSource.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/ClangASTSource.h Wed Jul 17 17:17:41 2013
@@ -404,10 +404,8 @@ protected:
     /// @return
     ///     The imported type.
     //------------------------------------------------------------------
-    void *
-    GuardedCopyType (clang::ASTContext *dest_context, 
-                     clang::ASTContext *source_context,
-                     void *clang_type);
+    ClangASTType
+    GuardedCopyType (const ClangASTType &src_type);
     
     friend struct NameSearchContext;
     
@@ -434,7 +432,7 @@ struct NameSearchContext {
     ClangASTImporter::NamespaceMapSP m_namespace_map;           ///< The mapping of all namespaces found for this request back to their modules
     const clang::DeclarationName &m_decl_name;                  ///< The name being looked for
     const clang::DeclContext *m_decl_context;                   ///< The DeclContext to put declarations into
-    llvm::SmallSet <lldb::clang_type_t, 5> m_function_types;    ///< All the types of functions that have been reported, so we don't report conflicts
+    llvm::SmallSet <ClangASTType, 5> m_function_types;    ///< All the types of functions that have been reported, so we don't report conflicts
     
     struct {
         bool variable                   : 1;
@@ -479,7 +477,7 @@ struct NameSearchContext {
     /// @param[in] type
     ///     The opaque QualType for the VarDecl being registered.
     //------------------------------------------------------------------
-    clang::NamedDecl *AddVarDecl(void *type);
+    clang::NamedDecl *AddVarDecl(const ClangASTType &type);
     
     //------------------------------------------------------------------
     /// Create a FunDecl with the name being searched for and the provided
@@ -488,7 +486,7 @@ struct NameSearchContext {
     /// @param[in] type
     ///     The opaque QualType for the FunDecl being registered.
     //------------------------------------------------------------------
-    clang::NamedDecl *AddFunDecl(void *type);
+    clang::NamedDecl *AddFunDecl(const ClangASTType &type);
     
     //------------------------------------------------------------------
     /// Create a FunDecl with the name being searched for and generic
@@ -504,7 +502,7 @@ struct NameSearchContext {
     /// @param[in] type
     ///     The opaque QualType for the TypeDecl being registered.
     //------------------------------------------------------------------
-    clang::NamedDecl *AddTypeDecl(void *type);
+    clang::NamedDecl *AddTypeDecl(const ClangASTType &clang_type);
     
     
     //------------------------------------------------------------------

Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionDeclMap.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionDeclMap.h Wed Jul 17 17:17:41 2013
@@ -549,8 +549,8 @@ private:
     /// @param[in] var
     ///     The variable to evaluate.
     ///
-    /// @param[in] parser_ast_context
-    ///     The AST context of the parser, to store the found type in.
+    /// @param[out] var_location
+    ///     The variable location value to fill in
     ///
     /// @param[out] found_type
     ///     The type of the found value, as it was found in the user process.
@@ -566,11 +566,11 @@ private:
     ///     The Decl to be looked up.
     ///
     /// @return
-    ///     The LLDB Value for the variable.
+    ///     Return true if the value was successfully filled in.
     //------------------------------------------------------------------
-    Value *
+    bool
     GetVariableValue (lldb::VariableSP &var,
-                      clang::ASTContext *parser_ast_context,
+                      lldb_private::Value &var_location,
                       TypeFromUser *found_type = NULL,
                       TypeFromParser *parser_type = NULL);
     

Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionVariable.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionVariable.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/ClangExpressionVariable.h Wed Jul 17 17:17:41 2013
@@ -25,6 +25,7 @@
 #include "lldb/lldb-public.h"
 #include "lldb/Core/ClangForward.h"
 #include "lldb/Core/ConstString.h"
+#include "lldb/Core/Value.h"
 #include "lldb/Symbol/TaggedASTType.h"
 
 namespace llvm {
@@ -98,7 +99,7 @@ public:
             m_parser_type(),
             m_named_decl (NULL),
             m_llvm_value (NULL),
-            m_lldb_value (NULL),
+            m_lldb_value (),
             m_lldb_var   (),
             m_lldb_sym   (NULL)
         {
@@ -107,7 +108,7 @@ public:
         TypeFromParser          m_parser_type;  ///< The type of the variable according to the parser
         const clang::NamedDecl *m_named_decl;   ///< The Decl corresponding to this variable
         llvm::Value            *m_llvm_value;   ///< The IR value corresponding to this variable; usually a GlobalValue
-        lldb_private::Value    *m_lldb_value;   ///< The value found in LLDB for this variable
+        lldb_private::Value     m_lldb_value;   ///< The value found in LLDB for this variable
         lldb::VariableSP        m_lldb_var;     ///< The original variable for this variable
         const lldb_private::Symbol *m_lldb_sym; ///< The original symbol for this variable, if it was a symbol
     };
@@ -215,17 +216,11 @@ public:
     void
     SetRegisterInfo (const RegisterInfo *reg_info);
 
-    lldb::clang_type_t
+    ClangASTType
     GetClangType ();
     
     void
-    SetClangType (lldb::clang_type_t);
-
-    clang::ASTContext *
-    GetClangAST ();
-    
-    void
-    SetClangAST (clang::ASTContext *ast);
+    SetClangType (const ClangASTType &clang_type);
 
     TypeFromUser
     GetTypeFromUser ();
@@ -420,8 +415,7 @@ public:
     {
         lldb::ClangExpressionVariableSP var_sp(new ClangExpressionVariable(exe_scope, byte_order, addr_byte_size));
         var_sp->SetName (name);
-        var_sp->SetClangType (user_type.GetOpaqueQualType());
-        var_sp->SetClangAST (user_type.GetASTContext());
+        var_sp->SetClangType (user_type);
         m_variables.push_back(var_sp);
         return var_sp;
     }

Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/ClangFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/ClangFunction.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/ClangFunction.h Wed Jul 17 17:17:41 2013
@@ -112,8 +112,7 @@ public:
     ///     be overridden using WriteFunctionArguments().
 	//------------------------------------------------------------------
 	ClangFunction (ExecutionContextScope &exe_scope,
-                   ClangASTContext *ast_context, 
-                   void *return_qualtype, 
+                   const ClangASTType &return_type,
                    const Address& function_address, 
                    const ValueList &arg_value_list);
     
@@ -624,7 +623,7 @@ private:
     
     Function                       *m_function_ptr;                 ///< The function we're going to call.  May be NULL if we don't have debug info for the function.
     Address                         m_function_addr;                ///< If we don't have the FunctionSP, we at least need the address & return type.
-    lldb::clang_type_t              m_function_return_qual_type;    ///< The opaque clang qual type for the function return type.
+    ClangASTType                    m_function_return_type;         ///< The opaque clang qual type for the function return type.
     ClangASTContext                *m_clang_ast_context;            ///< This is the clang_ast_context that we're getting types from the and value, and the function return the function pointer is NULL.
 
     std::string                     m_wrapper_function_name;        ///< The name of the wrapper function.

Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/DWARFExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/DWARFExpression.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/DWARFExpression.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/DWARFExpression.h Wed Jul 17 17:17:41 2013
@@ -250,7 +250,6 @@ public:
     //------------------------------------------------------------------
     bool
     Evaluate (ExecutionContextScope *exe_scope,
-              clang::ASTContext *ast_context,
               ClangExpressionVariableList *expr_locals,
               ClangExpressionDeclMap *decl_map,
               lldb::addr_t loclist_base_load_addr,
@@ -264,7 +263,6 @@ public:
     //------------------------------------------------------------------
     bool
     Evaluate (ExecutionContext *exe_ctx,
-              clang::ASTContext *ast_context,
               ClangExpressionVariableList *expr_locals,
               ClangExpressionDeclMap *decl_map,
               RegisterContext *reg_ctx,
@@ -281,9 +279,6 @@ public:
     ///     expression.  The location expression may access the target's
     ///     memory, especially if it comes from the expression parser.
     ///
-    /// @param[in] ast_context
-    ///     The context in which to interpret types.
-    ///
     /// @param[in] opcodes
     ///     This is a static method so the opcodes need to be provided
     ///     explicitly.
@@ -334,7 +329,6 @@ public:
     //------------------------------------------------------------------
     static bool
     Evaluate (ExecutionContext *exe_ctx,
-              clang::ASTContext *ast_context,
               ClangExpressionVariableList *expr_locals,
               ClangExpressionDeclMap *decl_map,
               RegisterContext *reg_ctx,

Modified: lldb/branches/lldb-platform-work/include/lldb/Host/ReadWriteLock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/ReadWriteLock.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Host/ReadWriteLock.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Host/ReadWriteLock.h Wed Jul 17 17:17:41 2013
@@ -170,64 +170,6 @@ public:
         DISALLOW_COPY_AND_ASSIGN(ReadLocker);
     };
 
-    class WriteLocker
-    {
-    public:
-        WriteLocker () :
-            m_lock (NULL)
-        {
-        }
-
-        WriteLocker (ReadWriteLock &lock) :
-            m_lock (NULL)
-        {
-            Lock(&lock);
-        }
-
-        WriteLocker (ReadWriteLock *lock) :
-            m_lock (NULL)
-        {
-            Lock(lock);
-        }
-
-        ~WriteLocker()
-        {
-            Unlock();
-        }
-
-        void
-        Lock (ReadWriteLock *lock)
-        {
-            if (m_lock)
-            {
-                if (m_lock == lock)
-                    return; // We already have this lock locked
-                else
-                    Unlock();
-            }
-            if (lock)
-            {
-                lock->WriteLock();
-                m_lock = lock;
-            }
-        }
-
-        void
-        Unlock ()
-        {
-            if (m_lock)
-            {
-                m_lock->WriteUnlock();
-                m_lock = NULL;
-            }
-        }
-        
-    protected:
-        ReadWriteLock *m_lock;
-    private:
-        DISALLOW_COPY_AND_ASSIGN(WriteLocker);
-    };
-
 protected:
     pthread_rwlock_t m_rwlock;
 private:

Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandHistory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandHistory.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandHistory.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandHistory.h Wed Jul 17 17:17:41 2013
@@ -59,7 +59,7 @@ public:
     void
     Dump (Stream& stream,
           size_t start_idx = 0,
-          size_t stop_idx = UINT64_MAX) const;
+          size_t stop_idx = SIZE_MAX) const;
     
     static const char g_repeat_char = '!';
     

Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h Wed Jul 17 17:17:41 2013
@@ -142,12 +142,12 @@ public:
     AppendErrorWithFormat (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
 
     void
-    SetError (const Error &error, 
+    SetError (const Error &error,
               const char *fallback_error_cstr = NULL);
-
+    
     void
     SetError (const char *error_cstr);
-    
+
     lldb::ReturnStatus
     GetStatus();
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/PythonDataObjects.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/PythonDataObjects.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/PythonDataObjects.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/PythonDataObjects.h Wed Jul 17 17:17:41 2013
@@ -99,6 +99,12 @@ namespace lldb_private {
             return m_py_obj;
         }
         
+        PythonString
+        Repr ();
+        
+        PythonString
+        Str ();
+        
         operator bool () const
         {
             return m_py_obj != NULL;

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h Wed Jul 17 17:17:41 2013
@@ -35,31 +35,6 @@ class Declaration;
 class ClangASTContext
 {
 public:
-    enum {
-        eTypeHasChildren        = (1u <<  0),
-        eTypeHasValue           = (1u <<  1),
-        eTypeIsArray            = (1u <<  2),
-        eTypeIsBlock            = (1u <<  3),
-        eTypeIsBuiltIn          = (1u <<  4),
-        eTypeIsClass            = (1u <<  5),
-        eTypeIsCPlusPlus        = (1u <<  6),
-        eTypeIsEnumeration      = (1u <<  7),
-        eTypeIsFuncPrototype    = (1u <<  8),
-        eTypeIsMember           = (1u <<  9),
-        eTypeIsObjC             = (1u << 10),
-        eTypeIsPointer          = (1u << 11),
-        eTypeIsReference        = (1u << 12),
-        eTypeIsStructUnion      = (1u << 13),
-        eTypeIsTemplate         = (1u << 14),
-        eTypeIsTypedef          = (1u << 15),
-        eTypeIsVector           = (1u << 16),
-        eTypeIsScalar           = (1u << 17),
-        eTypeIsInteger          = (1u << 18),
-        eTypeIsFloat            = (1u << 19),
-        eTypeIsComplex          = (1u << 20),
-        eTypeIsSigned           = (1u << 21)
-    };
-
     typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
     typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
     
@@ -123,20 +98,6 @@ public:
 
     void
     RemoveExternalSource ();
-
-    bool
-    GetCompleteType (lldb::clang_type_t clang_type);
-    
-    static bool
-    GetCompleteType (clang::ASTContext *ast,
-                     lldb::clang_type_t clang_type);
-
-    bool
-    IsCompleteType (lldb::clang_type_t clang_type);
-    
-    static bool
-    IsCompleteType (clang::ASTContext *ast,
-                    lldb::clang_type_t clang_type);
     
     bool
     GetCompleteDecl (clang::Decl *decl)
@@ -175,70 +136,48 @@ public:
     //------------------------------------------------------------------
     // Basic Types
     //------------------------------------------------------------------
-
-    lldb::clang_type_t
+    ClangASTType
     GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding,
                                           uint32_t bit_size);
-    
-    static lldb::clang_type_t
+
+    static ClangASTType
     GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast,
                                          lldb::Encoding encoding,
                                          uint32_t bit_size);
 
-    lldb::clang_type_t
-    GetBuiltinTypeForDWARFEncodingAndBitSize (
-        const char *type_name,
-        uint32_t dw_ate,
-        uint32_t bit_size);
+    ClangASTType
+    GetBasicType (lldb::BasicType type);
 
-    static lldb::clang_type_t
-    GetBuiltInType_void(clang::ASTContext *ast);
+    static ClangASTType
+    GetBasicType (clang::ASTContext *ast, lldb::BasicType type);
     
-    lldb::clang_type_t
-    GetBuiltInType_void()
-    {
-        return GetBuiltInType_void(getASTContext());
-    }
+    static ClangASTType
+    GetBasicType (clang::ASTContext *ast, const ConstString &name);
     
-    lldb::clang_type_t
-    GetBuiltInType_bool();
+    static lldb::BasicType
+    GetBasicTypeEnumeration (const ConstString &name);
 
-    lldb::clang_type_t
-    GetBuiltInType_objc_id();
-    
-    static lldb::clang_type_t
-    GetBuiltInType_objc_id(clang::ASTContext *ast);
+    ClangASTType
+    GetBuiltinTypeForDWARFEncodingAndBitSize (
+        const char *type_name,
+        uint32_t dw_ate,
+        uint32_t bit_size);
 
-    lldb::clang_type_t
-    GetBuiltInType_objc_Class();
+    ClangASTType
+    GetCStringType(bool is_const);
     
-    static lldb::clang_type_t
+    static ClangASTType
     GetUnknownAnyType(clang::ASTContext *ast);
     
-    lldb::clang_type_t
+    ClangASTType
     GetUnknownAnyType()
     {
         return ClangASTContext::GetUnknownAnyType(getASTContext());
     }
-
-    lldb::clang_type_t
-    GetBuiltInType_objc_selector();
-
-    lldb::clang_type_t
-    GetCStringType(bool is_const);
-    
-    lldb::clang_type_t
-    GetVoidType();
     
-    lldb::clang_type_t
-    GetVoidType(clang::ASTContext *ast);
+    uint32_t
+    GetPointerByteSize ();
 
-    lldb::clang_type_t
-    GetVoidPtrType(bool is_const);
-    
-    static lldb::clang_type_t
-    GetVoidPtrType(clang::ASTContext *ast, bool is_const);
-    
     static clang::DeclContext *
     GetTranslationUnitDecl (clang::ASTContext *ast);
     
@@ -254,10 +193,9 @@ public:
                                       bool &is_instance_method,
                                       ConstString &language_object_name);
     
-    static lldb::clang_type_t
+    static ClangASTType
     CopyType(clang::ASTContext *dest_context, 
-             clang::ASTContext *source_context,
-             lldb::clang_type_t clang_type);
+             ClangASTType source_type);
     
     static clang::Decl *
     CopyDecl (clang::ASTContext *dest_context, 
@@ -265,146 +203,42 @@ public:
               clang::Decl *source_decl);
 
     static bool
-    AreTypesSame(clang::ASTContext *ast,
-                 lldb::clang_type_t type1,
-                 lldb::clang_type_t type2,
+    AreTypesSame(ClangASTType type1,
+                 ClangASTType type2,
                  bool ignore_qualifiers = false);
     
-    bool
-    AreTypesSame(lldb::clang_type_t type1,
-                 lldb::clang_type_t type2,
-                 bool ignore_qualifiers = false)
-    {
-        return ClangASTContext::AreTypesSame(getASTContext(), type1, type2, ignore_qualifiers);
-    }
-    
-    
-    lldb::clang_type_t
+    ClangASTType
     GetTypeForDecl (clang::TagDecl *decl);
     
-    lldb::clang_type_t
+    ClangASTType
     GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl);
 
-    static lldb::BasicType
-    GetLLDBBasicTypeEnumeration (lldb::clang_type_t clang_type);
-
     //------------------------------------------------------------------
-    // CVR modifiers
+    // Structure, Unions, Classes
     //------------------------------------------------------------------
 
-    static lldb::clang_type_t
-    AddConstModifier (lldb::clang_type_t clang_type);
+    static clang::AccessSpecifier
+    ConvertAccessTypeToAccessSpecifier (lldb::AccessType access);
 
-    static lldb::clang_type_t
-    AddRestrictModifier (lldb::clang_type_t clang_type);
+    static clang::AccessSpecifier
+    UnifyAccessSpecifiers (clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
 
-    static lldb::clang_type_t
-    AddVolatileModifier (lldb::clang_type_t clang_type);
+    static uint32_t
+    GetNumBaseClasses (const clang::CXXRecordDecl *cxx_record_decl,
+                       bool omit_empty_base_classes);
 
-    //------------------------------------------------------------------
-    // Structure, Unions, Classes
-    //------------------------------------------------------------------
+    static uint32_t
+    GetIndexForRecordBase (const clang::RecordDecl *record_decl,
+                           const clang::CXXBaseSpecifier *base_spec,
+                           bool omit_empty_base_classes);
 
-    lldb::clang_type_t
+    ClangASTType
     CreateRecordType (clang::DeclContext *decl_ctx,
                       lldb::AccessType access_type,
                       const char *name,
                       int kind,
                       lldb::LanguageType language,
                       ClangASTMetadata *metadata = NULL);
-
-    static clang::FieldDecl *
-    AddFieldToRecordType (clang::ASTContext *ast,
-                          lldb::clang_type_t record_qual_type,
-                          const char *name,
-                          lldb::clang_type_t field_type,
-                          lldb::AccessType access,
-                          uint32_t bitfield_bit_size);
-    
-    clang::FieldDecl *
-    AddFieldToRecordType (lldb::clang_type_t record_qual_type,
-                          const char *name,
-                          lldb::clang_type_t field_type,
-                          lldb::AccessType access,
-                          uint32_t bitfield_bit_size)
-    {
-        return ClangASTContext::AddFieldToRecordType (getASTContext(),
-                                                      record_qual_type,
-                                                      name,
-                                                      field_type,
-                                                      access,
-                                                      bitfield_bit_size);
-    }
-    
-    clang::VarDecl *
-    AddVariableToRecordType (lldb::clang_type_t record_opaque_type,
-                             const char *name,
-                             lldb::clang_type_t var_opaque_type,
-                             lldb::AccessType access)
-    {
-        return ClangASTContext::AddVariableToRecordType (getASTContext(),
-                                                         record_opaque_type,
-                                                         name,
-                                                         var_opaque_type,
-                                                         access);
-    }
-
-    static clang::VarDecl *
-    AddVariableToRecordType (clang::ASTContext *ast,
-                             lldb::clang_type_t record_opaque_type,
-                             const char *name,
-                             lldb::clang_type_t var_opaque_type,
-                             lldb::AccessType access);
-
-    static void
-    BuildIndirectFields (clang::ASTContext *ast,
-                         lldb::clang_type_t record_qual_type);
-    
-    void
-    BuildIndirectFields (lldb::clang_type_t record_qual_type)
-    {
-        ClangASTContext::BuildIndirectFields(getASTContext(),
-                                             record_qual_type);
-    }
-    
-    static clang::CXXMethodDecl *
-    AddMethodToCXXRecordType (clang::ASTContext *ast,
-                              lldb::clang_type_t record_opaque_type,
-                              const char *name,
-                              lldb::clang_type_t method_type,
-                              lldb::AccessType access,
-                              bool is_virtual,
-                              bool is_static,
-                              bool is_inline,
-                              bool is_explicit,
-                              bool is_attr_used,
-                              bool is_artificial);
-    
-    clang::CXXMethodDecl *
-    AddMethodToCXXRecordType (lldb::clang_type_t record_opaque_type,
-                              const char *name,
-                              lldb::clang_type_t method_type,
-                              lldb::AccessType access,
-                              bool is_virtual,
-                              bool is_static,
-                              bool is_inline,
-                              bool is_explicit,
-                              bool is_attr_used,
-                              bool is_artificial)
-    
-    {
-        return ClangASTContext::AddMethodToCXXRecordType (getASTContext(),
-                                                          record_opaque_type,
-                                                          name,
-                                                          method_type,
-                                                          access,
-                                                          is_virtual,
-                                                          is_static,
-                                                          is_inline,
-                                                          is_explicit,
-                                                          is_attr_used,
-                                                          is_artificial);
-    }
     
     class TemplateParameterInfos
     {
@@ -453,7 +287,7 @@ public:
                                            int kind,
                                            const TemplateParameterInfos &infos);
 
-    lldb::clang_type_t
+    ClangASTType
     CreateClassTemplateSpecializationType (clang::ClassTemplateSpecializationDecl *class_template_specialization_decl);
 
     static clang::DeclContext *
@@ -479,292 +313,16 @@ public:
     static bool
     RecordHasFields (const clang::RecordDecl *record_decl);
 
-    void
-    SetDefaultAccessForRecordFields (lldb::clang_type_t clang_type,
-                                     int default_accessibility,
-                                     int *assigned_accessibilities,
-                                     size_t num_assigned_accessibilities);
 
-    lldb::clang_type_t
+    ClangASTType
     CreateObjCClass (const char *name, 
                      clang::DeclContext *decl_ctx, 
                      bool isForwardDecl, 
                      bool isInternal,
                      ClangASTMetadata *metadata = NULL);
-    
-    static clang::FieldDecl *
-    AddObjCClassIVar (clang::ASTContext *ast,
-                      lldb::clang_type_t class_opaque_type, 
-                      const char *name, 
-                      lldb::clang_type_t ivar_opaque_type, 
-                      lldb::AccessType access, 
-                      uint32_t bitfield_bit_size, 
-                      bool isSynthesized);
-    
-    clang::FieldDecl *
-    AddObjCClassIVar (lldb::clang_type_t class_opaque_type, 
-                      const char *name, 
-                      lldb::clang_type_t ivar_opaque_type, 
-                      lldb::AccessType access, 
-                      uint32_t bitfield_bit_size, 
-                      bool isSynthesized)
-    {
-        return ClangASTContext::AddObjCClassIVar (getASTContext(),
-                                                  class_opaque_type,
-                                                  name,
-                                                  ivar_opaque_type,
-                                                  access,
-                                                  bitfield_bit_size,
-                                                  isSynthesized);
-    }
-
-    static bool
-    AddObjCClassProperty 
-    (
-        clang::ASTContext *ast,
-        lldb::clang_type_t class_opaque_type, 
-        const char *property_name,
-        lldb::clang_type_t property_opaque_type,  // The property type is only required if you don't have an ivar decl
-        clang::ObjCIvarDecl *ivar_decl,   
-        const char *property_setter_name,
-        const char *property_getter_name,
-        uint32_t property_attributes,
-        ClangASTMetadata *metadata = NULL
-    );
-
-    bool
-    AddObjCClassProperty 
-    (
-        lldb::clang_type_t class_opaque_type, 
-        const char *property_name,
-        lldb::clang_type_t property_opaque_type,  
-        clang::ObjCIvarDecl *ivar_decl,   
-        const char *property_setter_name,
-        const char *property_getter_name,
-        uint32_t property_attributes,
-        ClangASTMetadata *metadata = NULL
-    )
-    {
-        return ClangASTContext::AddObjCClassProperty (getASTContext(),
-                                                      class_opaque_type, 
-                                                      property_name,
-                                                      property_opaque_type,
-                                                      ivar_decl,
-                                                      property_setter_name,
-                                                      property_getter_name,
-                                                      property_attributes,
-                                                      metadata);
-    }
-    
-    bool
-    SetObjCSuperClass (lldb::clang_type_t class_clang_type,
-                       lldb::clang_type_t superclass_clang_type);
-
-    static bool
-    ObjCTypeHasIVars (lldb::clang_type_t class_clang_type, bool check_superclass);
-
-    static bool
-    ObjCDeclHasIVars (clang::ObjCInterfaceDecl *class_interface_decl, 
-                      bool check_superclass);
-
-
-    static clang::ObjCMethodDecl *
-    AddMethodToObjCObjectType (clang::ASTContext *ast,
-                               lldb::clang_type_t class_opaque_type, 
-                               const char *name,  // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
-                               lldb::clang_type_t method_opaque_type,
-                               lldb::AccessType access,
-                               bool is_artificial);
-
-    clang::ObjCMethodDecl *
-    AddMethodToObjCObjectType (lldb::clang_type_t class_opaque_type, 
-                               const char *name,  // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
-                               lldb::clang_type_t method_opaque_type,
-                               lldb::AccessType access,
-                               bool is_artificial)
-    {
-        return AddMethodToObjCObjectType (getASTContext(),
-                                          class_opaque_type,
-                                          name,
-                                          method_opaque_type,
-                                          access, is_artificial);
-    }
-
-    static bool
-    SetHasExternalStorage (lldb::clang_type_t clang_type, bool has_extern);
-
-    //------------------------------------------------------------------
-    // Aggregate Types
-    //------------------------------------------------------------------
-    static bool
-    IsAggregateType (lldb::clang_type_t clang_type);
 
     // Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations
-    static uint32_t
-    GetTypeInfo (lldb::clang_type_t clang_type, 
-                 clang::ASTContext *ast,                // The AST for clang_type (can be NULL)
-                 lldb::clang_type_t *pointee_or_element_type);  // (can be NULL)
-
-    static uint32_t
-    GetNumChildren (clang::ASTContext *ast,
-                    lldb::clang_type_t clang_type,
-                    bool omit_empty_base_classes);
-
-    static uint32_t 
-    GetNumDirectBaseClasses (clang::ASTContext *ast, 
-                             lldb::clang_type_t clang_type);
-
-    static uint32_t 
-    GetNumVirtualBaseClasses (clang::ASTContext *ast, 
-                              lldb::clang_type_t clang_type);
-
-    static uint32_t 
-    GetNumFields (clang::ASTContext *ast, 
-                  lldb::clang_type_t clang_type);
-    
-    static lldb::clang_type_t
-    GetDirectBaseClassAtIndex (clang::ASTContext *ast, 
-                               lldb::clang_type_t clang_type,
-                               size_t idx, 
-                               uint32_t *bit_offset_ptr);
-
-    static lldb::clang_type_t
-    GetVirtualBaseClassAtIndex (clang::ASTContext *ast, 
-                                lldb::clang_type_t clang_type,
-                                size_t idx, 
-                                uint32_t *bit_offset_ptr);
-
-    static lldb::clang_type_t
-    GetFieldAtIndex (clang::ASTContext *ast, 
-                     lldb::clang_type_t clang_type,
-                     size_t idx, 
-                     std::string& name,
-                     uint64_t *bit_offset_ptr,
-                     uint32_t *bitfield_bit_size_ptr,
-                     bool *is_bitfield_ptr);
-    
-    static size_t
-    GetIndexOfFieldWithName (clang::ASTContext *ast,
-                             lldb::clang_type_t clang_type,
-                             const char* name,
-                             lldb::clang_type_t* field_clang_type = NULL,
-                             uint64_t *bit_offset_ptr = NULL,
-                             uint32_t *bitfield_bit_size_ptr = NULL,
-                             bool *is_bitfield_ptr = NULL);
-
-    static uint32_t
-    GetNumPointeeChildren (lldb::clang_type_t clang_type);
-
-    lldb::clang_type_t
-    GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
-                              const char *parent_name,
-                              lldb::clang_type_t  parent_clang_type,
-                              size_t idx,
-                              bool transparent_pointers,
-                              bool omit_empty_base_classes,
-                              bool ignore_array_bounds,
-                              std::string& child_name,
-                              uint32_t &child_byte_size,
-                              int32_t &child_byte_offset,
-                              uint32_t &child_bitfield_bit_size,
-                              uint32_t &child_bitfield_bit_offset,
-                              bool &child_is_base_class,
-                              bool &child_is_deref_of_parent);
- 
-    static lldb::clang_type_t
-    GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
-                              clang::ASTContext *ast,
-                              const char *parent_name,
-                              lldb::clang_type_t  parent_clang_type,
-                              size_t idx,
-                              bool transparent_pointers,
-                              bool omit_empty_base_classes,
-                              bool ignore_array_bounds,
-                              std::string& child_name,
-                              uint32_t &child_byte_size,
-                              int32_t &child_byte_offset,
-                              uint32_t &child_bitfield_bit_size,
-                              uint32_t &child_bitfield_bit_offset,
-                              bool &child_is_base_class,
-                              bool &child_is_deref_of_parent);
-    
-    // Lookup a child given a name. This function will match base class names
-    // and member member names in "clang_type" only, not descendants.
-    static uint32_t
-    GetIndexOfChildWithName (clang::ASTContext *ast,
-                             lldb::clang_type_t clang_type,
-                             const char *name,
-                             bool omit_empty_base_classes);
-
-    // Lookup a child member given a name. This function will match member names
-    // only and will descend into "clang_type" children in search for the first
-    // member in this class, or any base class that matches "name".
-    // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
-    // so we catch all names that match a given child name, not just the first.
-    static size_t
-    GetIndexOfChildMemberWithName (clang::ASTContext *ast,
-                                   lldb::clang_type_t clang_type,
-                                   const char *name,
-                                   bool omit_empty_base_classes,
-                                   std::vector<uint32_t>& child_indexes);
 
-    size_t
-    GetNumTemplateArguments (lldb::clang_type_t clang_type)
-    {
-        return GetNumTemplateArguments(getASTContext(), clang_type);
-    }
-
-    lldb::clang_type_t
-    GetTemplateArgument (lldb::clang_type_t clang_type, 
-                         size_t idx, 
-                         lldb::TemplateArgumentKind &kind)
-    {
-        return GetTemplateArgument(getASTContext(), clang_type, idx, kind);
-    }
-
-    static size_t
-    GetNumTemplateArguments (clang::ASTContext *ast, 
-                             lldb::clang_type_t clang_type);
-    
-    static lldb::clang_type_t
-    GetTemplateArgument (clang::ASTContext *ast, 
-                         lldb::clang_type_t clang_type, 
-                         size_t idx, 
-                         lldb::TemplateArgumentKind &kind);
-
-    //------------------------------------------------------------------
-    // clang::TagType
-    //------------------------------------------------------------------
-
-    bool
-    SetTagTypeKind (lldb::clang_type_t  tag_qual_type,
-                    int kind);
-
-    //------------------------------------------------------------------
-    // C++ Base Classes
-    //------------------------------------------------------------------
-
-    clang::CXXBaseSpecifier *
-    CreateBaseClassSpecifier (lldb::clang_type_t  base_class_type,
-                              lldb::AccessType access,
-                              bool is_virtual,
-                              bool base_of_class);
-    
-    static void
-    DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes, 
-                               unsigned num_base_classes);
-
-    bool
-    SetBaseClassesForClassType (lldb::clang_type_t  class_clang_type,
-                                clang::CXXBaseSpecifier const * const *base_classes,
-                                unsigned num_base_classes);
-
-    //------------------------------------------------------------------
-    // DeclContext Functions
-    //------------------------------------------------------------------
-
-    static clang::DeclContext *
-    GetDeclContextForType (lldb::clang_type_t  qual_type);
 
     //------------------------------------------------------------------
     // Namespace Declarations
@@ -781,21 +339,21 @@ public:
     clang::FunctionDecl *
     CreateFunctionDeclaration (clang::DeclContext *decl_ctx,
                                const char *name,
-                               lldb::clang_type_t  function_Type,
+                               const ClangASTType &function_Type,
                                int storage,
                                bool is_inline);
     
-    static lldb::clang_type_t
+    static ClangASTType
     CreateFunctionType (clang::ASTContext *ast,
-                        lldb::clang_type_t result_type,
-                        lldb::clang_type_t *args,
+                        const ClangASTType &result_type,
+                        const ClangASTType *args,
                         unsigned num_args,
                         bool is_variadic,
                         unsigned type_quals);
     
-    lldb::clang_type_t
-    CreateFunctionType (lldb::clang_type_t result_type,
-                        lldb::clang_type_t *args,
+    ClangASTType
+    CreateFunctionType (const ClangASTType &result_type,
+                        const ClangASTType *args,
                         unsigned num_args,
                         bool is_variadic,
                         unsigned type_quals)
@@ -810,8 +368,8 @@ public:
     
     clang::ParmVarDecl *
     CreateParameterDeclaration (const char *name,
-                               lldb::clang_type_t param_type,
-                               int storage);
+                                const ClangASTType &param_type,
+                                int storage);
 
     void
     SetFunctionParameters (clang::FunctionDecl *function_decl,
@@ -822,222 +380,54 @@ public:
     // Array Types
     //------------------------------------------------------------------
 
-    lldb::clang_type_t
-    CreateArrayType (lldb::clang_type_t element_type,
+    ClangASTType
+    CreateArrayType (const ClangASTType &element_type,
                      size_t element_count,
                      bool is_vector);
 
     //------------------------------------------------------------------
-    // Tag Declarations
-    //------------------------------------------------------------------
-    bool
-    StartTagDeclarationDefinition (lldb::clang_type_t  qual_type);
-
-    bool
-    CompleteTagDeclarationDefinition (lldb::clang_type_t  qual_type);
-
-    //------------------------------------------------------------------
     // Enumeration Types
     //------------------------------------------------------------------
-    lldb::clang_type_t
+    ClangASTType
     CreateEnumerationType (const char *name, 
                            clang::DeclContext *decl_ctx, 
                            const Declaration &decl, 
-                           lldb::clang_type_t integer_qual_type);
-
-    static lldb::clang_type_t
-    GetEnumerationIntegerType (lldb::clang_type_t enum_clang_type);
-    
-    bool
-    AddEnumerationValueToEnumerationType (lldb::clang_type_t  enum_qual_type,
-                                          lldb::clang_type_t  enumerator_qual_type,
-                                          const Declaration &decl,
-                                          const char *name,
-                                          int64_t enum_value,
-                                          uint32_t enum_value_bit_size);
-    
-    //------------------------------------------------------------------
-    // Pointers & References
-    //------------------------------------------------------------------
-    lldb::clang_type_t
-    CreatePointerType (lldb::clang_type_t clang_type);
-
-    static lldb::clang_type_t
-    CreatePointerType (clang::ASTContext *ast, 
-                       lldb::clang_type_t clang_type);
-
-    static lldb::clang_type_t
-    CreateLValueReferenceType (clang::ASTContext *ast_context,
-                               lldb::clang_type_t clang_type);
-    
-    static lldb::clang_type_t
-    CreateRValueReferenceType (clang::ASTContext *ast_context,
-                               lldb::clang_type_t clang_type);
-    
-    lldb::clang_type_t
-    CreateLValueReferenceType (lldb::clang_type_t clang_type)
-    {
-        return ClangASTContext::CreateLValueReferenceType(getASTContext(), clang_type);
-    }
-
-    lldb::clang_type_t
-    CreateRValueReferenceType (lldb::clang_type_t clang_type)
-    {
-        return ClangASTContext::CreateRValueReferenceType(getASTContext(), clang_type);
-    }
-
-    lldb::clang_type_t
-    CreateMemberPointerType (lldb::clang_type_t  clang_pointee_type,
-                             lldb::clang_type_t  clang_class_type);
-
-    uint64_t
-    GetPointerBitSize ();
-
-    static bool
-    IsIntegerType (lldb::clang_type_t clang_type, bool &is_signed);
-    
-    static bool
-    IsPointerType (lldb::clang_type_t clang_type, lldb::clang_type_t *target_type = NULL);
-
-    static bool
-    IsReferenceType (lldb::clang_type_t clang_type, lldb::clang_type_t *target_type = NULL);
-    
-    static bool
-    IsPointerOrReferenceType (lldb::clang_type_t clang_type, lldb::clang_type_t *target_type = NULL);
-    
-    static bool
-    IsPossibleCPlusPlusDynamicType (clang::ASTContext *ast,
-                                    lldb::clang_type_t clang_type, 
-                                    lldb::clang_type_t *target_type = NULL);
-
-    static bool
-    IsPossibleDynamicType (clang::ASTContext *ast, 
-                           lldb::clang_type_t clang_type, 
-                           lldb::clang_type_t *dynamic_pointee_type, // Can pass NULL
-                           bool check_cplusplus,
-                           bool check_objc);
-
-    static bool
-    IsCStringType (lldb::clang_type_t clang_type, uint32_t &length);
-
-    static bool
-    IsFunctionPointerType (lldb::clang_type_t clang_type);
+                           const ClangASTType &integer_qual_type);
     
-    static lldb::clang_type_t
-    GetAsArrayType (lldb::clang_type_t clang_type, 
-                    lldb::clang_type_t *member_type,
-                    uint64_t *size,
-                    bool *is_incomplete);
-    
-    static bool
-    IsArrayType (lldb::clang_type_t clang_type,
-                 lldb::clang_type_t *member_type,
-                 uint64_t *size,
-                 bool *is_incomplete)
-    {
-        return GetAsArrayType(clang_type, member_type, size, is_incomplete) != 0;
-    }
-
-    //------------------------------------------------------------------
-    // Typedefs
     //------------------------------------------------------------------
-    lldb::clang_type_t
-    CreateTypedefType (const char *name,
-                       lldb::clang_type_t clang_type,
-                       clang::DeclContext *decl_ctx);
-
-    //------------------------------------------------------------------
-    // Type names
+    // Floating point functions
     //------------------------------------------------------------------
-    static bool
-    IsFloatingPointType (lldb::clang_type_t clang_type, uint32_t &count, bool &is_complex);
     
-    // true iff this is one of the types that can "fit"
-    // in a Scalar object
-    static bool
-    IsScalarType (lldb::clang_type_t clang_type);
-    
-    static bool
-    IsPointerToScalarType (lldb::clang_type_t clang_type);
-
-    static bool
-    IsArrayOfScalarType (lldb::clang_type_t clang_type);
-    
-    static bool
-    GetCXXClassName (lldb::clang_type_t clang_type, 
-                     std::string &class_name);
-
-    static bool
-    IsCXXClassType (lldb::clang_type_t clang_type);
-    
-    static bool
-    IsBeingDefined (lldb::clang_type_t clang_type);
-    
-    static bool
-    IsObjCClassType (lldb::clang_type_t clang_type);
-    
-    static bool
-    IsObjCObjectPointerType (lldb::clang_type_t clang_type, lldb::clang_type_t *target_type);
-    
-    static bool
-    GetObjCClassName (lldb::clang_type_t clang_type,
-                      std::string &class_name);
-
-    static bool
-    IsCharType (lldb::clang_type_t clang_type);
-
-    static size_t
-    GetArraySize (lldb::clang_type_t clang_type);
-
-    //static bool
-    //ConvertFloatValueToString (clang::ASTContext *ast, 
-    //                           lldb::clang_type_t clang_type, 
-    //                           const uint8_t* bytes, 
-    //                           size_t byte_size, 
-    //                           int apint_byte_order, 
-    //                           std::string &float_str);
-    
-    static size_t
-    ConvertStringToFloatValue (clang::ASTContext *ast, 
-                               lldb::clang_type_t clang_type, 
-                               const char *s, 
-                               uint8_t *dst, 
-                               size_t dst_size);
-
-    lldb::clang_type_t
+    ClangASTType
     GetFloatTypeFromBitSize (size_t bit_size)
     {
         return GetFloatTypeFromBitSize (getASTContext(), bit_size);
     }
 
-    static lldb::clang_type_t
+    static ClangASTType
     GetFloatTypeFromBitSize (clang::ASTContext *ast,
                              size_t bit_size);
-    //------------------------------------------------------------------
-    // Qualifiers
-    //------------------------------------------------------------------
-    static unsigned
-    GetTypeQualifiers(lldb::clang_type_t clang_type);
 protected:
     //------------------------------------------------------------------
     // Classes that inherit from ClangASTContext can see and modify these
     //------------------------------------------------------------------
     std::string                                     m_target_triple;
-    std::unique_ptr<clang::ASTContext>               m_ast_ap;
-    std::unique_ptr<clang::LangOptions>              m_language_options_ap;
-    std::unique_ptr<clang::FileManager>              m_file_manager_ap;
-    std::unique_ptr<clang::FileSystemOptions>        m_file_system_options_ap;
-    std::unique_ptr<clang::SourceManager>            m_source_manager_ap;
-    std::unique_ptr<clang::DiagnosticsEngine>        m_diagnostics_engine_ap;
-    std::unique_ptr<clang::DiagnosticConsumer>       m_diagnostic_consumer_ap;
+    std::unique_ptr<clang::ASTContext>              m_ast_ap;
+    std::unique_ptr<clang::LangOptions>             m_language_options_ap;
+    std::unique_ptr<clang::FileManager>             m_file_manager_ap;
+    std::unique_ptr<clang::FileSystemOptions>       m_file_system_options_ap;
+    std::unique_ptr<clang::SourceManager>           m_source_manager_ap;
+    std::unique_ptr<clang::DiagnosticsEngine>       m_diagnostics_engine_ap;
+    std::unique_ptr<clang::DiagnosticConsumer>      m_diagnostic_consumer_ap;
     llvm::IntrusiveRefCntPtr<clang::TargetOptions>  m_target_options_rp;
-    std::unique_ptr<clang::TargetInfo>               m_target_info_ap;
-    std::unique_ptr<clang::IdentifierTable>          m_identifier_table_ap;
-    std::unique_ptr<clang::SelectorTable>            m_selector_table_ap;
-    std::unique_ptr<clang::Builtin::Context>         m_builtins_ap;
+    std::unique_ptr<clang::TargetInfo>              m_target_info_ap;
+    std::unique_ptr<clang::IdentifierTable>         m_identifier_table_ap;
+    std::unique_ptr<clang::SelectorTable>           m_selector_table_ap;
+    std::unique_ptr<clang::Builtin::Context>        m_builtins_ap;
     CompleteTagDeclCallback                         m_callback_tag_decl;
     CompleteObjCInterfaceDeclCallback               m_callback_objc_decl;
     void *                                          m_callback_baton;
+    uint32_t                                        m_pointer_byte_size;
 private:
     //------------------------------------------------------------------
     // For ClangASTContext only

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTImporter.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTImporter.h Wed Jul 17 17:17:41 2013
@@ -14,7 +14,6 @@
 #include <set>
 
 #include "lldb/lldb-types.h"
-
 #include "clang/AST/ASTImporter.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemOptions.h"

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h Wed Jul 17 17:17:41 2013
@@ -13,6 +13,7 @@
 #include <string>
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ClangForward.h"
+#include "clang/AST/Type.h"
 
 namespace lldb_private {
 
@@ -29,16 +30,46 @@ namespace lldb_private {
 class ClangASTType
 {
 public:
-    
+    enum {
+        eTypeHasChildren        = (1u <<  0),
+        eTypeHasValue           = (1u <<  1),
+        eTypeIsArray            = (1u <<  2),
+        eTypeIsBlock            = (1u <<  3),
+        eTypeIsBuiltIn          = (1u <<  4),
+        eTypeIsClass            = (1u <<  5),
+        eTypeIsCPlusPlus        = (1u <<  6),
+        eTypeIsEnumeration      = (1u <<  7),
+        eTypeIsFuncPrototype    = (1u <<  8),
+        eTypeIsMember           = (1u <<  9),
+        eTypeIsObjC             = (1u << 10),
+        eTypeIsPointer          = (1u << 11),
+        eTypeIsReference        = (1u << 12),
+        eTypeIsStructUnion      = (1u << 13),
+        eTypeIsTemplate         = (1u << 14),
+        eTypeIsTypedef          = (1u << 15),
+        eTypeIsVector           = (1u << 16),
+        eTypeIsScalar           = (1u << 17),
+        eTypeIsInteger          = (1u << 18),
+        eTypeIsFloat            = (1u << 19),
+        eTypeIsComplex          = (1u << 20),
+        eTypeIsSigned           = (1u << 21)
+    };
+    
+
+    //----------------------------------------------------------------------
+    // Constructors and Destructors
+    //----------------------------------------------------------------------
     ClangASTType (clang::ASTContext *ast_context, lldb::clang_type_t type) :
         m_type (type),
         m_ast  (ast_context) 
     {
     }
-    
-    ClangASTType (const ClangASTType &tw) :
-        m_type (tw.m_type),
-        m_ast  (tw.m_ast)
+
+    ClangASTType (clang::ASTContext *ast_context, clang::QualType qual_type);
+
+    ClangASTType (const ClangASTType &rhs) :
+        m_type (rhs.m_type),
+        m_ast  (rhs.m_ast)
     {
     }
     
@@ -48,125 +79,500 @@ public:
     {
     }
     
-    virtual ~ClangASTType();
+    ~ClangASTType();
     
+    //----------------------------------------------------------------------
+    // Operators
+    //----------------------------------------------------------------------
+
     const ClangASTType &
-    operator= (const ClangASTType &atb)
+    operator= (const ClangASTType &rhs)
     {
-        m_type = atb.m_type;
-        m_ast = atb.m_ast;
+        m_type = rhs.m_type;
+        m_ast = rhs.m_ast;
         return *this;
     }
     
+
+    //----------------------------------------------------------------------
+    // Tests
+    //----------------------------------------------------------------------
+
+    operator bool () const
+    {
+        return m_type != NULL && m_ast != NULL;
+    }
+    
+    bool
+    operator < (const ClangASTType &rhs) const
+    {
+        if (m_ast == rhs.m_ast)
+            return m_type < rhs.m_type;
+        return m_ast < rhs.m_ast;
+    }
+
     bool
     IsValid () const
     {
         return m_type != NULL && m_ast != NULL;
     }
+    
+    bool
+    IsArrayType (ClangASTType *element_type,
+                 uint64_t *size,
+                 bool *is_incomplete) const;
 
-    lldb::clang_type_t
-    GetOpaqueQualType() const
-    { 
-        return m_type; 
+    bool
+    IsArrayOfScalarType () const;
+
+    bool
+    IsAggregateType () const;
+    
+    bool
+    IsBeingDefined () const;
+
+    bool
+    IsCharType () const;
+
+    bool
+    IsCompleteType () const;
+    
+    bool
+    IsConst() const;
+    
+    bool
+    IsCStringType (uint32_t &length) const;
+
+    bool
+    IsCXXClassType () const;
+    
+    bool
+    IsDefined() const;
+    
+    bool
+    IsFloatingPointType (uint32_t &count, bool &is_complex) const;
+
+    bool
+    IsFunctionType (bool *is_variadic_ptr = NULL) const;
+
+    bool
+    IsVariadicFunctionType () const;
+
+    bool
+    IsFunctionPointerType () const;
+    
+    bool
+    IsIntegerType (bool &is_signed) const;
+
+    bool
+    IsObjCClassType () const;
+    
+    bool
+    IsObjCClassTypeAndHasIVars (bool check_superclass) const;
+    
+    bool
+    IsObjCObjectOrInterfaceType () const;
+
+    bool
+    IsObjCObjectPointerType (ClangASTType *target_type = NULL);
+    
+    bool
+    IsPolymorphicClass () const;
+
+    bool
+    IsPossibleCPlusPlusDynamicType (ClangASTType *target_type = NULL) const
+    {
+        return IsPossibleDynamicType (target_type, true, false);
     }
     
+    bool
+    IsPossibleDynamicType (ClangASTType *target_type, // Can pass NULL
+                           bool check_cplusplus,
+                           bool check_objc) const;
+
+
+    bool
+    IsPointerToScalarType () const;
+    
+    bool
+    IsPointerType (ClangASTType *pointee_type = NULL) const;
+    
+    bool
+    IsPointerOrReferenceType (ClangASTType *pointee_type = NULL) const;
+    
+    bool
+    IsReferenceType (ClangASTType *pointee_type = NULL) const;
+    
+    bool
+    IsScalarType () const;
+    
+    bool
+    IsTypedefType () const;
+
+    bool
+    IsVoidType () const;
+
+    bool
+    GetCXXClassName (std::string &class_name) const;
+    
+    bool
+    GetObjCClassName (std::string &class_name);
+    
+
+    //----------------------------------------------------------------------
+    // Type Completion
+    //----------------------------------------------------------------------
+    
+    bool
+    GetCompleteType () const;
+
+    //----------------------------------------------------------------------
+    // AST related queries
+    //----------------------------------------------------------------------
+
+    size_t
+    GetPointerByteSize () const;
+    
+    //----------------------------------------------------------------------
+    // Accessors
+    //----------------------------------------------------------------------
+    
     clang::ASTContext *
     GetASTContext() const
-    { 
-        return m_ast; 
+    {
+        return m_ast;
     }
+    
+    ConstString
+    GetConstQualifiedTypeName () const;
 
-    static ClangASTType
-    GetCanonicalType (clang::ASTContext *ast, lldb::clang_type_t clang_type);
+    ConstString
+    GetConstTypeName () const;
+    
+    std::string
+    GetTypeName () const;
 
-    ClangASTType
-    GetCanonicalType ()
+    uint32_t
+    GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL) const;
+    
+    lldb::LanguageType
+    GetMinimumLanguage ();
+
+    lldb::clang_type_t
+    GetOpaqueQualType() const
     {
-        return GetCanonicalType (GetASTContext(), GetOpaqueQualType());
+        return m_type;
     }
 
-    ConstString
-    GetConstTypeName ();
+    lldb::TypeClass
+    GetTypeClass () const;
     
-    ConstString
-    GetConstQualifiedTypeName ();
+    void
+    SetClangType (clang::ASTContext *ast, lldb::clang_type_t type)
+    {
+        m_ast = ast;
+        m_type = type;
+    }
 
-    static lldb::BasicType
-    GetBasicTypeEnumeration (const ConstString &name);
+    void
+    SetClangType (clang::ASTContext *ast, clang::QualType qual_type);
 
-    static ClangASTType
-    GetBasicType (clang::ASTContext *ast, lldb::BasicType type);
+    unsigned
+    GetTypeQualifiers() const;
+    
+    //----------------------------------------------------------------------
+    // Creating related types
+    //----------------------------------------------------------------------
 
-    static ClangASTType
-    GetBasicType (clang::ASTContext *ast, const ConstString &name);
+    ClangASTType
+    AddConstModifier () const;
 
-    static ConstString
-    GetConstTypeName (clang::ASTContext *ast,
-                      lldb::clang_type_t clang_type);
-    
-    static ConstString
-    GetConstQualifiedTypeName (clang::ASTContext *ast,
-                               lldb::clang_type_t clang_type);
-
-    static std::string
-    GetTypeNameForQualType (clang::ASTContext *ast,
-                            clang::QualType qual_type);
-
-    static std::string
-    GetTypeNameForOpaqueQualType (clang::ASTContext *ast,
-                                  lldb::clang_type_t opaque_qual_type);
+    ClangASTType
+    AddRestrictModifier () const;
 
-    uint64_t
-    GetClangTypeByteSize ();
+    ClangASTType
+    AddVolatileModifier () const;
+    
+    // Using the current type, create a new typedef to that type using "typedef_name"
+    // as the name and "decl_ctx" as the decl context.
+    ClangASTType
+    CreateTypedefType (const char *typedef_name,
+                       clang::DeclContext *decl_ctx) const;
+    
+    ClangASTType
+    GetArrayElementType (uint64_t& stride) const;
+    
+    ClangASTType
+    GetCanonicalType () const;
+    
+    ClangASTType
+    GetFullyUnqualifiedType () const;
+    
+    // Returns -1 if this isn't a function of if the fucntion doesn't have a prototype
+    // Returns a value >= 0 if there is a prototype.
+    int
+    GetFunctionArgumentCount () const;
+
+    ClangASTType
+    GetFunctionArgumentTypeAtIndex (size_t idx);
+
+    ClangASTType
+    GetFunctionReturnType () const;
+    
+    ClangASTType
+    GetLValueReferenceType () const;
+    
+    ClangASTType
+    GetNonReferenceType () const;
+
+    ClangASTType
+    GetPointeeType () const;
+    
+    ClangASTType
+    GetPointerType () const;
+    
+    ClangASTType
+    GetRValueReferenceType () const;
 
-    static uint64_t
-    GetClangTypeByteSize (clang::ASTContext *ast_context,
-                          lldb::clang_type_t clang_type);
+    // If the current object represents a typedef type, get the underlying type
+    ClangASTType
+    GetTypedefedType () const;
+
+    ClangASTType
+    RemoveFastQualifiers () const;
     
+    //----------------------------------------------------------------------
+    // Create related types using the current type's AST
+    //----------------------------------------------------------------------
+    ClangASTType
+    GetBasicTypeFromAST (lldb::BasicType basic_type) const;
+
+    //----------------------------------------------------------------------
+    // Exploring the type
+    //----------------------------------------------------------------------
+
     uint64_t
-    GetClangTypeBitWidth ();
+    GetByteSize () const;
 
-    static uint64_t
-    GetClangTypeBitWidth (clang::ASTContext *ast_context, lldb::clang_type_t opaque_clang_qual_type);
+    uint64_t
+    GetBitSize () const;
 
+    lldb::Encoding
+    GetEncoding (uint64_t &count) const;
+    
+    lldb::Format
+    GetFormat () const;
+    
     size_t
-    GetTypeBitAlign ();
+    GetTypeBitAlign () const;
+
+    uint32_t
+    GetNumChildren (bool omit_empty_base_classes) const;
+
+    lldb::BasicType
+    GetBasicTypeEnumeration () const;
+
+    static lldb::BasicType
+    GetBasicTypeEnumeration (const ConstString &name);
+
+    uint32_t
+    GetNumDirectBaseClasses () const;
+    
+    uint32_t
+    GetNumVirtualBaseClasses () const;
     
-    static size_t
-    GetTypeBitAlign (clang::ASTContext *ast_context, lldb::clang_type_t clang_type);
+    uint32_t
+    GetNumFields () const;
+    
+    ClangASTType
+    GetDirectBaseClassAtIndex (size_t idx,
+                               uint32_t *bit_offset_ptr) const;
+    
+    ClangASTType
+    GetVirtualBaseClassAtIndex (size_t idx,
+                                uint32_t *bit_offset_ptr) const;
+    
+    ClangASTType
+    GetFieldAtIndex (size_t idx,
+                     std::string& name,
+                     uint64_t *bit_offset_ptr,
+                     uint32_t *bitfield_bit_size_ptr,
+                     bool *is_bitfield_ptr) const;
+    
+    uint32_t
+    GetIndexOfFieldWithName (const char* name,
+                             ClangASTType* field_clang_type = NULL,
+                             uint64_t *bit_offset_ptr = NULL,
+                             uint32_t *bitfield_bit_size_ptr = NULL,
+                             bool *is_bitfield_ptr = NULL) const;
+    
+    uint32_t
+    GetNumPointeeChildren () const;
+    
+    ClangASTType
+    GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
+                              const char *parent_name,
+                              size_t idx,
+                              bool transparent_pointers,
+                              bool omit_empty_base_classes,
+                              bool ignore_array_bounds,
+                              std::string& child_name,
+                              uint32_t &child_byte_size,
+                              int32_t &child_byte_offset,
+                              uint32_t &child_bitfield_bit_size,
+                              uint32_t &child_bitfield_bit_offset,
+                              bool &child_is_base_class,
+                              bool &child_is_deref_of_parent) const;
+    
+    // Lookup a child given a name. This function will match base class names
+    // and member member names in "clang_type" only, not descendants.
+    uint32_t
+    GetIndexOfChildWithName (const char *name,
+                             bool omit_empty_base_classes) const;
+    
+    // Lookup a child member given a name. This function will match member names
+    // only and will descend into "clang_type" children in search for the first
+    // member in this class, or any base class that matches "name".
+    // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
+    // so we catch all names that match a given child name, not just the first.
+    size_t
+    GetIndexOfChildMemberWithName (const char *name,
+                                   bool omit_empty_base_classes,
+                                   std::vector<uint32_t>& child_indexes) const;
+    
+    size_t
+    GetNumTemplateArguments () const;
+    
+    ClangASTType
+    GetTemplateArgument (size_t idx,
+                         lldb::TemplateArgumentKind &kind) const;
 
-    lldb::LanguageType
-    GetMinimumLanguage ();
 
-    static lldb::LanguageType
-    GetMinimumLanguage (clang::ASTContext *ctx,
-                        lldb::clang_type_t clang_type);
-
-    static lldb::TypeClass
-    GetTypeClass (clang::ASTContext *ast_context, 
-                  lldb::clang_type_t clang_type);
+    //----------------------------------------------------------------------
+    // Modifying RecordType
+    //----------------------------------------------------------------------
+    clang::FieldDecl *
+    AddFieldToRecordType (const char *name,
+                          const ClangASTType &field_type,
+                          lldb::AccessType access,
+                          uint32_t bitfield_bit_size);
+    
+    void
+    BuildIndirectFields ();
+    
+    clang::VarDecl *
+    AddVariableToRecordType (const char *name,
+                             const ClangASTType &var_type,
+                             lldb::AccessType access);
+
+    clang::CXXMethodDecl *
+    AddMethodToCXXRecordType (const char *name,
+                              const ClangASTType &method_type,
+                              lldb::AccessType access,
+                              bool is_virtual,
+                              bool is_static,
+                              bool is_inline,
+                              bool is_explicit,
+                              bool is_attr_used,
+                              bool is_artificial);
+    
+    // C++ Base Classes
+    clang::CXXBaseSpecifier *
+    CreateBaseClassSpecifier (lldb::AccessType access,
+                              bool is_virtual,
+                              bool base_of_class);
+    
+    static void
+    DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes,
+                               unsigned num_base_classes);
+    
+    bool
+    SetBaseClassesForClassType (clang::CXXBaseSpecifier const * const *base_classes,
+                                unsigned num_base_classes);
+    
+
+    bool
+    SetObjCSuperClass (const ClangASTType &superclass_clang_type);
+    
+    bool
+    AddObjCClassProperty (const char *property_name,
+                          const ClangASTType &property_clang_type,
+                          clang::ObjCIvarDecl *ivar_decl,
+                          const char *property_setter_name,
+                          const char *property_getter_name,
+                          uint32_t property_attributes,
+                          ClangASTMetadata *metadata);
+
+    clang::ObjCMethodDecl *
+    AddMethodToObjCObjectType (const char *name,  // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
+                               const ClangASTType &method_clang_type,
+                               lldb::AccessType access,
+                               bool is_artificial);
+
+    clang::DeclContext *
+    GetDeclContextForType () const;
 
-    lldb::TypeClass
-    GetTypeClass () const
-    {
-        return GetTypeClass (GetASTContext(), GetOpaqueQualType());
-    }
     
     bool
-    IsPolymorphicClass ()
-    {
-        return IsPolymorphicClass(GetASTContext(), GetOpaqueQualType());
-    }
+    SetDefaultAccessForRecordFields (int default_accessibility,
+                                     int *assigned_accessibilities,
+                                     size_t num_assigned_accessibilities);
     
-    static bool
-    IsPolymorphicClass (clang::ASTContext *ast_context, lldb::clang_type_t clang_type);
+    bool
+    SetHasExternalStorage (bool has_extern);
+    
+    
+    //------------------------------------------------------------------
+    // clang::TagType
+    //------------------------------------------------------------------
+    
+    bool
+    SetTagTypeKind (int kind) const;
+    
+    //------------------------------------------------------------------
+    // Tag Declarations
+    //------------------------------------------------------------------
+    bool
+    StartTagDeclarationDefinition ();
+    
+    bool
+    CompleteTagDeclarationDefinition ();
+    
+    //----------------------------------------------------------------------
+    // Modifying Enumeration types
+    //----------------------------------------------------------------------
+    bool
+    AddEnumerationValueToEnumerationType (const ClangASTType &enumerator_qual_type,
+                                          const Declaration &decl,
+                                          const char *name,
+                                          int64_t enum_value,
+                                          uint32_t enum_value_bit_size);
+    
+
     
     ClangASTType
-    GetFullyUnqualifiedType ();
+    GetEnumerationIntegerType () const;
+
     
-    static ClangASTType
-    GetFullyUnqualifiedType (clang::ASTContext *ast_context, lldb::clang_type_t clang_type);
+    //------------------------------------------------------------------
+    // Pointers & References
+    //------------------------------------------------------------------
+
+    // Call this function using the class type when you want to make a
+    // member pointer type to pointee_type.
+    ClangASTType
+    CreateMemberPointerType (const ClangASTType &pointee_type) const;
     
+    
+    // Converts "s" to a floating point value and place resulting floating
+    // point bytes in the "dst" buffer.
+    size_t
+    ConvertStringToFloatValue (const char *s,
+                               uint8_t *dst,
+                               size_t dst_size) const;
+    //----------------------------------------------------------------------
+    // Dumping types
+    //----------------------------------------------------------------------
     void
     DumpValue (ExecutionContext *exe_ctx,
                Stream *s,
@@ -181,22 +587,6 @@ public:
                bool verbose,
                uint32_t depth);
 
-    static void
-    DumpValue (clang::ASTContext *ast_context,
-               lldb::clang_type_t opaque_clang_qual_type,
-               ExecutionContext *exe_ctx,
-               Stream *s,
-               lldb::Format format,
-               const DataExtractor &data,
-               lldb::offset_t data_offset,
-               size_t data_byte_size,
-               uint32_t bitfield_bit_size,
-               uint32_t bitfield_bit_offset,
-               bool show_types,
-               bool show_summary,
-               bool verbose,
-               uint32_t depth);
-
     bool
     DumpTypeValue (Stream *s,
                    lldb::Format format,
@@ -207,164 +597,50 @@ public:
                    uint32_t bitfield_bit_offset,
                    ExecutionContextScope *exe_scope);
     
-    
-    static bool
-    DumpTypeValue (clang::ASTContext *ast_context,
-                   lldb::clang_type_t opaque_clang_qual_type,
-                   Stream *s,
-                   lldb::Format format,
-                   const DataExtractor &data,
-                   lldb::offset_t data_offset,
-                   size_t data_byte_size,
-                   uint32_t bitfield_bit_size,
-                   uint32_t bitfield_bit_offset,
-                   ExecutionContextScope *exe_scope);
-
     void
     DumpSummary (ExecutionContext *exe_ctx,
                  Stream *s,
                  const DataExtractor &data,
                  lldb::offset_t data_offset,
                  size_t data_byte_size);
-                 
-    
-    static void
-    DumpSummary (clang::ASTContext *ast_context,
-                 lldb::clang_type_t opaque_clang_qual_type,
-                 ExecutionContext *exe_ctx,
-                 Stream *s,
-                 const DataExtractor &data,
-                 lldb::offset_t data_offset,
-                 size_t data_byte_size);
-    
-    void
-    DumpTypeDescription (); // Dump to stdout
 
     void
-    DumpTypeDescription (Stream *s);
-    
-    static void
-    DumpTypeDescription (clang::ASTContext *ast_context,
-                         lldb::clang_type_t opaque_clang_qual_type,
-                         Stream *s);
-    
-    lldb::Encoding
-    GetEncoding (uint64_t &count);
-
-    static lldb::Encoding
-    GetEncoding (lldb::clang_type_t opaque_clang_qual_type, uint64_t &count);
+    DumpTypeDescription () const; // Dump to stdout
 
-    lldb::Format
-    GetFormat ();
-                 
-    static lldb::Format
-    GetFormat (lldb::clang_type_t opaque_clang_qual_type);
-    
-    uint64_t
-    GetTypeByteSize() const;
+    void
+    DumpTypeDescription (Stream *s) const;
     
-    static uint64_t
-    GetTypeByteSize(clang::ASTContext *ast_context,
-                    lldb::clang_type_t opaque_clang_qual_type);
-
     bool
     GetValueAsScalar (const DataExtractor &data,
                       lldb::offset_t data_offset,
                       size_t data_byte_size,
-                      Scalar &value);
-
-    static bool
-    GetValueAsScalar (clang::ASTContext *ast_context,
-                      lldb::clang_type_t opaque_clang_qual_type,
-                      const DataExtractor &data,
-                      lldb::offset_t data_offset,
-                      size_t data_byte_size,
-                      Scalar &value);
-
+                      Scalar &value) const;
 
     bool
-    IsDefined();
-
-    static bool
-    IsDefined (lldb::clang_type_t opaque_clang_qual_type);
-
-    bool
-    IsConst();
-    
-    static bool
-    IsConst (lldb::clang_type_t opaque_clang_qual_type);
-    
-    bool
     SetValueFromScalar (const Scalar &value,
                         Stream &strm);
 
-    static bool
-    SetValueFromScalar (clang::ASTContext *ast_context,
-                        lldb::clang_type_t opaque_clang_qual_type,
-                        const Scalar &value,
-                        Stream &strm);
-
-    void
-    SetClangType (clang::ASTContext *ast, lldb::clang_type_t type)
-    {
-        m_type = type;
-        m_ast = ast;
-    }
-
     bool
     ReadFromMemory (ExecutionContext *exe_ctx,
                     lldb::addr_t addr,
                     AddressType address_type,
                     DataExtractor &data);
 
-    static bool
-    ReadFromMemory (clang::ASTContext *ast_context,
-                    lldb::clang_type_t opaque_clang_qual_type,
-                    ExecutionContext *exe_ctx,
-                    lldb::addr_t addr,
-                    AddressType address_type,
-                    DataExtractor &data);
-
     bool
     WriteToMemory (ExecutionContext *exe_ctx,
                    lldb::addr_t addr,
                    AddressType address_type,
                    StreamString &new_value);
 
-    static bool
-    WriteToMemory (clang::ASTContext *ast_context,
-                   lldb::clang_type_t opaque_clang_qual_type,
-                   ExecutionContext *exe_ctx,
-                   lldb::addr_t addr,
-                   AddressType address_type,
-                   StreamString &new_value);
-
-    lldb::clang_type_t
-    GetPointeeType () const;
-
-    static lldb::clang_type_t
-    GetPointeeType (lldb::clang_type_t opaque_clang_qual_type);
-    
-    lldb::clang_type_t
-    GetArrayElementType (uint64_t& stride);
     
-    static lldb::clang_type_t
-    GetArrayElementType (clang::ASTContext* ast,
-                         lldb::clang_type_t opaque_clang_qual_type,
-						 uint64_t& stride);
+    clang::RecordDecl *
+    GetAsRecordDecl () const;
     
-    lldb::clang_type_t
-    GetPointerType () const;
+    clang::CXXRecordDecl *
+    GetAsCXXRecordDecl () const;
     
-    static lldb::clang_type_t
-    GetPointerType (clang::ASTContext *ast_context,
-                    lldb::clang_type_t opaque_clang_qual_type);
-
-    static lldb::clang_type_t
-    RemoveFastQualifiers (lldb::clang_type_t);
-
-    static clang::CXXRecordDecl *
-    GetAsCXXRecordDecl (lldb::clang_type_t opaque_clang_qual_type);
+    clang::ObjCInterfaceDecl *
+    GetAsObjCInterfaceDecl () const;
 
     void
     Clear()
@@ -373,9 +649,25 @@ public:
         m_ast = NULL;
     }
 
+    clang::QualType
+    GetQualType () const
+    {
+        if (m_type)
+            return clang::QualType::getFromOpaquePtr(m_type);
+        return clang::QualType();
+    }
+    clang::QualType
+    GetCanonicalQualType () const
+    {
+        if (m_type)
+            return clang::QualType::getFromOpaquePtr(m_type).getCanonicalType();
+        return clang::QualType();
+    }
+
 private:
     lldb::clang_type_t m_type;
     clang::ASTContext *m_ast;
+    
 };
     
 bool operator == (const ClangASTType &lhs, const ClangASTType &rhs);

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/Function.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/Function.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/Function.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/Function.h Wed Jul 17 17:17:41 2013
@@ -564,19 +564,9 @@ public:
     //------------------------------------------------------------------
     const Type*
     GetType() const;
-
-    lldb::clang_type_t
-    GetReturnClangType ();
-
-    // The Number of arguments, or -1 for an unprototyped function.
-    int
-    GetArgumentCount ();
-
-    lldb::clang_type_t
-    GetArgumentTypeAtIndex (size_t idx);
-
-    bool
-    IsVariadic ();
+    
+    ClangASTType
+    GetClangType ();
 
     uint32_t
     GetPrologueByteSize ();

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h Wed Jul 17 17:17:41 2013
@@ -80,11 +80,6 @@ public:
         eStrataRawImage
     } Strata;
 
-    typedef enum
-    {
-        eSymtabFromUnifiedSectionList = 0x0001 /// Return symbol table from unified module section list
-    } SymtabFlags;
-
     //------------------------------------------------------------------
     /// Construct with a parent module, offset, and header data.
     ///
@@ -187,6 +182,7 @@ public:
     static size_t
     GetModuleSpecifications (const FileSpec &file,
                              lldb::offset_t file_offset,
+                             lldb::offset_t file_size,
                              ModuleSpecList &specs);
     
     static size_t
@@ -194,7 +190,7 @@ public:
                              lldb::DataBufferSP& data_sp,
                              lldb::offset_t data_offset,
                              lldb::offset_t file_offset,
-                             lldb::offset_t length,
+                             lldb::offset_t file_size,
                              lldb_private::ModuleSpecList &specs);
     //------------------------------------------------------------------
     /// Split a path into a file path with object name.
@@ -353,7 +349,10 @@ public:
     ///     The list of sections contained in this object file.
     //------------------------------------------------------------------
     virtual SectionList *
-    GetSectionList () = 0;
+    GetSectionList ();
+
+    virtual void
+    CreateSections (SectionList &unified_section_list) = 0;
 
     //------------------------------------------------------------------
     /// Gets the symbol table for the currently selected architecture
@@ -362,15 +361,21 @@ public:
     /// Symbol table parsing can be deferred by ObjectFile instances
     /// until this accessor is called the first time.
     ///
-    /// @param[in] flags
-    ///     eSymtabFromUnifiedSectionList: Whether to get symbol table
-    ///     for unified module section list, or object file.
-    ///
     /// @return
     ///     The symbol table for this object file.
     //------------------------------------------------------------------
     virtual Symtab *
-    GetSymtab (uint32_t flags = 0) = 0;
+    GetSymtab () = 0;
+
+    //------------------------------------------------------------------
+    /// Detect if this object file has been stripped of local symbols.
+    ///
+    /// @return
+    ///     Return \b true if the object file has been stripped of local
+    ///     symbols.
+    //------------------------------------------------------------------
+    virtual bool
+    IsStripped () = 0;
 
     //------------------------------------------------------------------
     /// Frees the symbol table.
@@ -385,7 +390,7 @@ public:
     ///     The symbol table for this object file.
     //------------------------------------------------------------------
     virtual void
-    ClearSymtab (uint32_t flags = 0);
+    ClearSymtab ();
     
     //------------------------------------------------------------------
     /// Gets the UUID for this object file.
@@ -676,8 +681,6 @@ protected:
     const lldb::addr_t m_memory_addr;
     std::unique_ptr<lldb_private::SectionList> m_sections_ap;
     std::unique_ptr<lldb_private::Symtab> m_symtab_ap;
-    std::unique_ptr<lldb_private::Symtab> m_symtab_unified_ap; ///< Unified section list symbol table.
-    uint32_t m_symtab_unified_revisionid; ///< Unified section list symbol table revision id for when m_symtab_unified_ap was last modified.
     
     //------------------------------------------------------------------
     /// Sets the architecture for a module.  At present the architecture

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h Wed Jul 17 17:17:41 2013
@@ -210,13 +210,19 @@ public:
     bool
     IsIndirect () const;
 
+    bool
+    GetByteSizeIsValid () const
+    {
+        return m_size_is_valid;
+    }
+
     lldb::addr_t
     GetByteSize () const;
     
     void
     SetByteSize (lldb::addr_t size)
     {
-        m_calculated_size = size > 0;
+        m_size_is_valid = size > 0;
         m_addr_range.SetByteSize(size);
     }
 
@@ -298,7 +304,7 @@ protected:
                     m_is_external:1,        // non-zero if this symbol is globally visible
                     m_size_is_sibling:1,    // m_size contains the index of this symbol's sibling
                     m_size_is_synthesized:1,// non-zero if this symbol's size was calculated using a delta between this symbol and the next
-                    m_calculated_size:1,
+                    m_size_is_valid:1,
                     m_demangled_is_synthesized:1, // The demangled name was created should not be used for expressions or other lookups
                     m_type:8;
     Mangled         m_mangled;              // uniqued symbol name/mangled name pair

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h Wed Jul 17 17:17:41 2013
@@ -128,7 +128,7 @@ public:
     virtual size_t          ParseTypes (const SymbolContext& sc) = 0;
     virtual size_t          ParseVariablesForContext (const SymbolContext& sc) = 0;
     virtual Type*           ResolveTypeUID (lldb::user_id_t type_uid) = 0;
-    virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type) = 0;
+    virtual bool            ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) = 0;
     virtual clang::DeclContext* GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid) { return NULL; }
     virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid) { return NULL; }
     virtual uint32_t        ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) = 0;

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h Wed Jul 17 17:17:41 2013
@@ -38,7 +38,7 @@ class SymbolVendor :
 public:
     static SymbolVendor*
     FindPlugin (const lldb::ModuleSP &module_sp,
-                lldb_private::Stream *feedback_strm);
+                Stream *feedback_strm);
 
     //------------------------------------------------------------------
     // Constructors and Destructors
@@ -126,7 +126,7 @@ public:
                size_t max_matches,
                TypeList& types);
 
-    virtual lldb_private::ClangNamespaceDecl
+    virtual ClangNamespaceDecl
     FindNamespace (const SymbolContext& sc, 
                    const ConstString &name,
                    const ClangNamespaceDecl *parent_namespace_decl);
@@ -154,9 +154,9 @@ public:
     }
 
     virtual size_t
-    GetTypes (lldb_private::SymbolContextScope *sc_scope,
+    GetTypes (SymbolContextScope *sc_scope,
               uint32_t type_mask,
-              lldb_private::TypeList &type_list);
+              TypeList &type_list);
 
     SymbolFile *
     GetSymbolFile()
@@ -175,7 +175,7 @@ public:
     //------------------------------------------------------------------
     // PluginInterface protocol
     //------------------------------------------------------------------
-    virtual lldb_private::ConstString
+    virtual ConstString
     GetPluginName();
 
     virtual uint32_t

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/Symtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/Symtab.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/Symtab.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/Symtab.h Wed Jul 17 17:17:41 2013
@@ -14,6 +14,7 @@
 #include <vector>
 
 #include "lldb/lldb-private.h"
+#include "lldb/Core/RangeMap.h"
 #include "lldb/Core/UniqueCStringMap.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/Symbol.h"
@@ -72,7 +73,7 @@ public:
             Symbol *    FindSymbolContainingFileAddress (lldb::addr_t file_addr, const uint32_t* indexes, uint32_t num_indexes);
             Symbol *    FindSymbolContainingFileAddress (lldb::addr_t file_addr);
             size_t      FindFunctionSymbols (const ConstString &name, uint32_t name_type_mask, SymbolContextList& sc_list);
-            size_t      CalculateSymbolSize (Symbol *symbol);
+            void        CalculateSymbolSizes ();
 
             void        SortSymbolIndexesByValue (std::vector<uint32_t>& indexes, bool remove_duplicates) const;
 
@@ -98,19 +99,19 @@ protected:
     typedef std::vector<Symbol>         collection;
     typedef collection::iterator        iterator;
     typedef collection::const_iterator  const_iterator;
-
+    typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t> FileRangeToIndexMap;
             void        InitNameIndexes ();
             void        InitAddressIndexes ();
 
     ObjectFile *        m_objfile;
     collection          m_symbols;
-    std::vector<uint32_t> m_addr_indexes;
+    FileRangeToIndexMap m_file_addr_to_index;
     UniqueCStringMap<uint32_t> m_name_to_index;
     UniqueCStringMap<uint32_t> m_basename_to_index;
     UniqueCStringMap<uint32_t> m_method_to_index;
     UniqueCStringMap<uint32_t> m_selector_to_index;
     mutable Mutex       m_mutex; // Provide thread safety for this symbol table
-    bool                m_addr_indexes_computed:1,
+    bool                m_file_addr_to_index_computed:1,
                         m_name_indexes_computed:1;
 private:
 

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/TaggedASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/TaggedASTType.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/TaggedASTType.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/TaggedASTType.h Wed Jul 17 17:17:41 2013
@@ -20,16 +20,30 @@ namespace lldb_private
 template <unsigned int C> class TaggedASTType : public ClangASTType
 {
 public:
+    TaggedASTType (const ClangASTType &clang_type) :
+        ClangASTType(clang_type)
+    {
+    }
+
     TaggedASTType (lldb::clang_type_t type, clang::ASTContext *ast_context) :
-        ClangASTType(ast_context, type) { }
+        ClangASTType(ast_context, type)
+    {
+    }
     
     TaggedASTType (const TaggedASTType<C> &tw) :
-        ClangASTType(tw) { }
+        ClangASTType(tw)
+    {
+    }
     
     TaggedASTType () :
-        ClangASTType() { }
+        ClangASTType()
+    {
+    }
     
-    virtual ~TaggedASTType() { }
+    virtual
+    ~TaggedASTType()
+    {
+    }
     
     TaggedASTType<C> &operator= (const TaggedASTType<C> &tw)
     {

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h Wed Jul 17 17:17:41 2013
@@ -16,6 +16,7 @@
 #include "lldb/Core/UserID.h"
 #include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Symbol/Declaration.h"
+
 #include <set>
 
 namespace lldb_private {
@@ -84,7 +85,7 @@ public:
           lldb::user_id_t encoding_uid,
           EncodingDataType encoding_uid_type,
           const Declaration& decl,
-          lldb::clang_type_t clang_qual_type,
+          const ClangASTType &clang_qual_type,
           ResolveState clang_type_resolve_state);
     
     // This makes an invalid type.  Used for functions that return a Type when they
@@ -226,23 +227,20 @@ public:
 
     // Get the clang type, and resolve definitions for any 
     // class/struct/union/enum types completely.
-    lldb::clang_type_t 
+    ClangASTType
     GetClangFullType ();
 
     // Get the clang type, and resolve definitions enough so that the type could
     // have layout performed. This allows ptrs and refs to class/struct/union/enum 
     // types remain forward declarations.
-    lldb::clang_type_t 
+    ClangASTType
     GetClangLayoutType ();
 
     // Get the clang type and leave class/struct/union/enum types as forward
     // declarations if they haven't already been fully defined.
-    lldb::clang_type_t 
+    ClangASTType 
     GetClangForwardType ();
 
-    clang::ASTContext *
-    GetClangAST ();
-
     ClangASTContext &
     GetClangASTContext ();
 
@@ -264,21 +262,10 @@ public:
 
     uint32_t
     GetEncodingMask ();
-
-    void *
-    CreateClangPointerType (Type *type);
-
-    void *
+    
+    ClangASTType
     CreateClangTypedefType (Type *typedef_type, Type *base_type);
 
-    // For C++98 references (&)
-    void *
-    CreateClangLValueReferenceType (Type *type);
-
-    // For C++0x references (&&)
-    void *
-    CreateClangRValueReferenceType (Type *type);
-    
     bool
     IsRealObjCClass();
     
@@ -303,7 +290,7 @@ protected:
     EncodingDataType m_encoding_uid_type;
     uint64_t m_byte_size;
     Declaration m_decl;
-    lldb::clang_type_t m_clang_type;
+    ClangASTType m_clang_type;
     
     struct Flags {
         ResolveState    clang_type_resolve_state : 2;

Removed: lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeHierarchyNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeHierarchyNavigator.h?rev=186539&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeHierarchyNavigator.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeHierarchyNavigator.h (removed)
@@ -1,75 +0,0 @@
-//===-- TypeHierarchyNavigator.h ------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_TypeHierarchyNavigator_h_
-#define lldb_TypeHierarchyNavigator_h_
-
-// C Includes
-// C++ Includes
-
-// Other libraries and framework includes
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/Type.h"
-#include "clang/AST/DeclObjC.h"
-
-// Project includes
-#include "lldb/lldb-public.h"
-#include "lldb/lldb-enumerations.h"
-
-namespace lldb_private {
-
-class TypeHierarchyNavigator {
-
-public:
-    
-    enum RelationshipToCurrentType
-    {
-        eRootType,
-        eCXXBaseClass,
-        eCXXVBaseClass,
-        eObjCBaseClass,
-        eStrippedPointer,
-        eStrippedReference,
-        eStrippedTypedef
-    };
-    
-    typedef bool (*TypeHierarchyNavigatorCallback)(const clang::QualType& qual_type,
-                                                   RelationshipToCurrentType reason_why_here,
-                                                   void* callback_baton);
-    
-    TypeHierarchyNavigator(const clang::QualType& qual_type,
-                           ValueObject& val_obj,
-                           void* callback_baton = NULL) : 
-        m_root_type(qual_type),
-        m_value_object(val_obj),
-        m_default_callback_baton(callback_baton)
-    {
-    }
-        
-    bool
-    LoopThrough(TypeHierarchyNavigatorCallback callback,
-                void* callback_baton = NULL);
-    
-private:
-    
-    bool
-    LoopThrough(const clang::QualType& qual_type,
-                TypeHierarchyNavigatorCallback callback,
-                RelationshipToCurrentType reason_why_here,
-                void* callback_baton);
-    
-    const clang::QualType& m_root_type;
-    ValueObject& m_value_object;
-    void* m_default_callback_baton;
-    
-};
-    
-} // namespace lldb_private
-
-#endif  // lldb_TypeHierarchyNavigator_h_

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Process.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Process.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Process.h Wed Jul 17 17:17:41 2013
@@ -1399,7 +1399,6 @@ public:
     // try to lock it to see if they can immediately access the stopped
     // process. If the try read lock fails, then the process is running.
     typedef ReadWriteLock::ReadLocker StopLocker;
-    typedef ReadWriteLock::WriteLocker RunLocker;
 
     // These two functions fill out the Broadcaster interface:
     

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOut.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOut.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOut.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOut.h Wed Jul 17 17:17:41 2013
@@ -63,7 +63,7 @@ private:
     bool m_stop_others;
     lldb::ThreadPlanSP m_step_through_inline_plan_sp;
     lldb::ThreadPlanSP m_step_out_plan_sp;
-    Function          *m_immediate_step_from_function;
+    Function *m_immediate_step_from_function;
     lldb::ValueObjectSP m_return_valobj_sp;
 
     friend ThreadPlan *

Modified: lldb/branches/lldb-platform-work/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lib/Makefile?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lib/Makefile (original)
+++ lldb/branches/lldb-platform-work/lib/Makefile Wed Jul 17 17:17:41 2013
@@ -99,13 +99,15 @@ ifeq ($(HOST_OS),Linux)
   USEDLIBS += lldbHostLinux.a \
               lldbPluginProcessLinux.a \
               lldbPluginProcessPOSIX.a \
-              lldbPluginDynamicLoaderMacOSX.a
+              lldbPluginDynamicLoaderMacOSX.a \
+              lldbPluginProcessElfCore.a
 endif
 
 ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
   USEDLIBS += lldbHostFreeBSD.a \
               lldbPluginProcessPOSIX.a \
-              lldbPluginProcessFreeBSD.a
+              lldbPluginProcessFreeBSD.a \
+              lldbPluginProcessElfCore.a
 endif
 
 include $(LEVEL)/Makefile.common

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Wed Jul 17 17:17:41 2013
@@ -92,6 +92,8 @@
 		2635879417822FC2004C30BA /* SymbolVendorELF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2635879017822E56004C30BA /* SymbolVendorELF.cpp */; };
 		26368A3C126B697600E8659F /* darwin-debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26368A3B126B697600E8659F /* darwin-debug.cpp */; };
 		26368AF7126B960500E8659F /* darwin-debug in Resources */ = {isa = PBXBuildFile; fileRef = 26579F68126A25920007C5CB /* darwin-debug */; };
+		263C4938178B50C40070F12D /* SBModuleSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263C4937178B50C40070F12D /* SBModuleSpec.cpp */; };
+		263C493A178B50CF0070F12D /* SBModuleSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 263C4939178B50CF0070F12D /* SBModuleSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		263E949F13661AEA00E7D1CE /* UnwindAssembly-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263E949D13661AE400E7D1CE /* UnwindAssembly-x86.cpp */; };
 		2640E19F15DC78FD00F23B50 /* Property.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2640E19E15DC78FD00F23B50 /* Property.cpp */; };
 		2642FBAE13D003B400ED6808 /* CommunicationKDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2642FBA813D003B400ED6808 /* CommunicationKDP.cpp */; };
@@ -540,7 +542,6 @@
 		9461569C14E358A6003A195C /* SBTypeSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568C14E35621003A195C /* SBTypeSummary.cpp */; };
 		9461569D14E358A6003A195C /* SBTypeSynthetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568D14E35621003A195C /* SBTypeSynthetic.cpp */; };
 		9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9463D4CC13B1798800C230D4 /* CommandObjectType.cpp */; };
-		9467E65213C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */; };
 		9475C18814E5E9FA001BFC6D /* SBTypeCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9475C18714E5E9FA001BFC6D /* SBTypeCategory.cpp */; };
 		9475C18914E5EA08001BFC6D /* SBTypeCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */; };
@@ -599,7 +600,6 @@
 		AFF87C89150FF672000E1742 /* com.apple.debugserver-secure.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = AFF87C88150FF672000E1742 /* com.apple.debugserver-secure.plist */; };
 		AFF87C8F150FF688000E1742 /* com.apple.debugserver.applist.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */; };
 		B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */; };
-		B21EB71515CC99F100E60059 /* cxa_demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B21EB71415CC99F100E60059 /* cxa_demangle.cpp */; settings = {COMPILER_FLAGS = "-frtti"; }; };
 		B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */; };
 		B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointList.cpp */; };
 		B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; };
@@ -935,6 +935,9 @@
 		263664921140A4930075843B /* Debugger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = Debugger.cpp; path = source/Core/Debugger.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		263664941140A4C10075843B /* Debugger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Debugger.h; path = include/lldb/Core/Debugger.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		26368A3B126B697600E8659F /* darwin-debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "darwin-debug.cpp"; path = "tools/darwin-debug/darwin-debug.cpp"; sourceTree = "<group>"; };
+		263C4937178B50C40070F12D /* SBModuleSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBModuleSpec.cpp; path = source/API/SBModuleSpec.cpp; sourceTree = "<group>"; };
+		263C4939178B50CF0070F12D /* SBModuleSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBModuleSpec.h; path = include/lldb/API/SBModuleSpec.h; sourceTree = "<group>"; };
+		263C493B178B61CC0070F12D /* SBModuleSpec.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBModuleSpec.i; sourceTree = "<group>"; };
 		263E949D13661AE400E7D1CE /* UnwindAssembly-x86.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "UnwindAssembly-x86.cpp"; sourceTree = "<group>"; };
 		263E949E13661AE400E7D1CE /* UnwindAssembly-x86.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UnwindAssembly-x86.h"; sourceTree = "<group>"; };
 		263FEDA5112CC1DA00E4C208 /* ThreadSafeSTLMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeSTLMap.h; path = include/lldb/Core/ThreadSafeSTLMap.h; sourceTree = "<group>"; };
@@ -1557,7 +1560,7 @@
 		69A01E1E1236C5D400C660B5 /* Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mutex.cpp; sourceTree = "<group>"; };
 		69A01E1F1236C5D400C660B5 /* Symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Symbols.cpp; sourceTree = "<group>"; };
 		69A01E201236C5D400C660B5 /* TimeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeValue.cpp; sourceTree = "<group>"; };
-		94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-wrapper.swig"; sourceTree = "<group>"; };
+		94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-wrapper.swig"; sourceTree = "<group>"; };
 		94005E0513F45A1B001EF42D /* embedded_interpreter.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = embedded_interpreter.py; path = source/Interpreter/embedded_interpreter.py; sourceTree = "<group>"; };
 		94031A9B13CF484600DCFF3C /* InputReaderEZ.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InputReaderEZ.h; path = include/lldb/Core/InputReaderEZ.h; sourceTree = "<group>"; };
 		94031A9D13CF486600DCFF3C /* InputReaderEZ.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InputReaderEZ.cpp; path = source/Core/InputReaderEZ.cpp; sourceTree = "<group>"; };
@@ -1573,7 +1576,7 @@
 		945759661534941F005A9070 /* PlatformPOSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformPOSIX.h; path = POSIX/PlatformPOSIX.h; sourceTree = "<group>"; };
 		945E8D7D152F6AA80019BCCD /* StreamGDBRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamGDBRemote.h; path = include/lldb/Core/StreamGDBRemote.h; sourceTree = "<group>"; };
 		945E8D7F152F6AB40019BCCD /* StreamGDBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamGDBRemote.cpp; path = source/Core/StreamGDBRemote.cpp; sourceTree = "<group>"; };
-		944DC3481774C99000D7D884 /* python-swigsafecast.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-swigsafecast.swig"; sourceTree = "<group>"; };
+		944DC3481774C99000D7D884 /* python-swigsafecast.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-swigsafecast.swig"; sourceTree = "<group>"; };
 		9452573616262CD000325455 /* SBDeclaration.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBDeclaration.i; sourceTree = "<group>"; };
 		9452573816262CEF00325455 /* SBDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBDeclaration.h; path = include/lldb/API/SBDeclaration.h; sourceTree = "<group>"; };
 		9452573916262D0200325455 /* SBDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBDeclaration.cpp; path = source/API/SBDeclaration.cpp; sourceTree = "<group>"; };
@@ -1595,8 +1598,6 @@
 		9461569514E3567F003A195C /* SBTypeSynthetic.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeSynthetic.i; sourceTree = "<group>"; };
 		9463D4CC13B1798800C230D4 /* CommandObjectType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = CommandObjectType.cpp; path = source/Commands/CommandObjectType.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		9463D4CE13B179A500C230D4 /* CommandObjectType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandObjectType.h; path = source/Commands/CommandObjectType.h; sourceTree = "<group>"; };
-		9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeHierarchyNavigator.cpp; path = source/Symbol/TypeHierarchyNavigator.cpp; sourceTree = "<group>"; };
-		9467E65413C3D98900B3B6F3 /* TypeHierarchyNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeHierarchyNavigator.h; path = include/lldb/Symbol/TypeHierarchyNavigator.h; sourceTree = "<group>"; };
 		9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeCategory.h; path = include/lldb/API/SBTypeCategory.h; sourceTree = "<group>"; };
 		9475C18714E5E9FA001BFC6D /* SBTypeCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeCategory.cpp; path = source/API/SBTypeCategory.cpp; sourceTree = "<group>"; };
 		9475C18A14E5EA1C001BFC6D /* SBTypeCategory.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeCategory.i; sourceTree = "<group>"; };
@@ -1644,7 +1645,7 @@
 		94D6A0A816CEB55F00833B6E /* NSDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSDictionary.cpp; path = source/DataFormatters/NSDictionary.cpp; sourceTree = "<group>"; };
 		94D6A0A916CEB55F00833B6E /* NSSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSSet.cpp; path = source/DataFormatters/NSSet.cpp; sourceTree = "<group>"; };
 		94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "modify-python-lldb.py"; sourceTree = "<group>"; };
-		94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-typemaps.swig"; sourceTree = "<group>"; };
+		94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-typemaps.swig"; sourceTree = "<group>"; };
 		94EA1D5A15E6C99B00D4171A /* PythonDataObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonDataObjects.h; path = include/lldb/Interpreter/PythonDataObjects.h; sourceTree = "<group>"; };
 		94EA1D5B15E6C9B400D4171A /* PythonDataObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonDataObjects.cpp; path = source/Interpreter/PythonDataObjects.cpp; sourceTree = "<group>"; };
 		94EBAC8313D9EE26009BA64E /* PythonPointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonPointer.h; path = include/lldb/Utility/PythonPointer.h; sourceTree = "<group>"; };
@@ -1674,7 +1675,7 @@
 		9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpointCommand.cpp; path = source/Commands/CommandObjectBreakpointCommand.cpp; sourceTree = "<group>"; };
 		9A4633DA11F65D8600955CE1 /* UserSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserSettingsController.h; path = include/lldb/Core/UserSettingsController.h; sourceTree = "<group>"; };
 		9A4633DC11F65D9A00955CE1 /* UserSettingsController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UserSettingsController.cpp; path = source/Core/UserSettingsController.cpp; sourceTree = "<group>"; };
-		9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = "python-extensions.swig"; sourceTree = "<group>"; };
+		9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "python-extensions.swig"; sourceTree = "<group>"; };
 		9A4F350F1368A51A00823F52 /* StreamAsynchronousIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamAsynchronousIO.cpp; path = source/Core/StreamAsynchronousIO.cpp; sourceTree = "<group>"; };
 		9A4F35111368A54100823F52 /* StreamAsynchronousIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamAsynchronousIO.h; path = include/lldb/Core/StreamAsynchronousIO.h; sourceTree = "<group>"; };
 		9A633FE7112DCE3C001A7E43 /* SBFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFrame.cpp; path = source/API/SBFrame.cpp; sourceTree = "<group>"; };
@@ -1736,8 +1737,6 @@
 		AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = com.apple.debugserver.applist.plist; path = tools/debugserver/source/com.apple.debugserver.applist.plist; sourceTree = "<group>"; };
 		B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectWatchpoint.cpp; path = source/Commands/CommandObjectWatchpoint.cpp; sourceTree = "<group>"; };
 		B207C4941429609C00F36E4E /* CommandObjectWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandObjectWatchpoint.h; path = source/Commands/CommandObjectWatchpoint.h; sourceTree = "<group>"; };
-		B21EB71415CC99F100E60059 /* cxa_demangle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cxa_demangle.cpp; path = source/Core/cxa_demangle.cpp; sourceTree = "<group>"; };
-		B21EB71815CC9B7500E60059 /* cxa_demangle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cxa_demangle.h; path = include/lldb/Core/cxa_demangle.h; sourceTree = "<group>"; };
 		B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = "<group>"; };
 		B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupWatchpoint.cpp; path = source/Interpreter/OptionGroupWatchpoint.cpp; sourceTree = "<group>"; };
 		B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupWatchpoint.h; path = include/lldb/Interpreter/OptionGroupWatchpoint.h; sourceTree = "<group>"; };
@@ -2131,6 +2130,7 @@
 				2611FF04142D83060017FEA3 /* SBLineEntry.i */,
 				2611FF05142D83060017FEA3 /* SBListener.i */,
 				2611FF06142D83060017FEA3 /* SBModule.i */,
+				263C493B178B61CC0070F12D /* SBModuleSpec.i */,
 				2611FF07142D83060017FEA3 /* SBProcess.i */,
 				2611FF08142D83060017FEA3 /* SBSection.i */,
 				2611FF09142D83060017FEA3 /* SBSourceManager.i */,
@@ -2229,6 +2229,8 @@
 				9A9831011125FC5800A56CB0 /* SBListener.cpp */,
 				26DE204E11618E9800A093E2 /* SBModule.h */,
 				26DE204C11618E7A00A093E2 /* SBModule.cpp */,
+				263C4939178B50CF0070F12D /* SBModuleSpec.h */,
+				263C4937178B50C40070F12D /* SBModuleSpec.cpp */,
 				9A9831041125FC5800A56CB0 /* SBProcess.h */,
 				9A9831031125FC5800A56CB0 /* SBProcess.cpp */,
 				26B8283C142D01E9002DBC64 /* SBSection.h */,
@@ -2626,9 +2628,7 @@
 				26BC7D6810F1B77400F91463 /* Log.h */,
 				26BC7E7F10F1B85900F91463 /* Log.cpp */,
 				26BC7D6910F1B77400F91463 /* Mangled.h */,
-				B21EB71815CC9B7500E60059 /* cxa_demangle.h */,
 				26BC7E8010F1B85900F91463 /* Mangled.cpp */,
-				B21EB71415CC99F100E60059 /* cxa_demangle.cpp */,
 				2682100C143A59AE004BCF2D /* MappedHash.h */,
 				26BC7D6A10F1B77400F91463 /* Module.h */,
 				26BC7E8110F1B85900F91463 /* Module.cpp */,
@@ -2767,8 +2767,6 @@
 				49BB309511F79450001A4197 /* TaggedASTType.h */,
 				26BC7C6510F1B6E900F91463 /* Type.h */,
 				26BC7F2010F1B8EC00F91463 /* Type.cpp */,
-				9467E65413C3D98900B3B6F3 /* TypeHierarchyNavigator.h */,
-				9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */,
 				26BC7C6610F1B6E900F91463 /* TypeList.h */,
 				26BC7F2110F1B8EC00F91463 /* TypeList.cpp */,
 				49B01A2D15F67B1700666829 /* TypeVendor.h */,
@@ -3583,6 +3581,7 @@
 				268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */,
 				2668022C115FD13D008E1FE4 /* SBTarget.h in Headers */,
 				2668022E115FD13D008E1FE4 /* SBThread.h in Headers */,
+				263C493A178B50CF0070F12D /* SBModuleSpec.h in Headers */,
 				2617447A11685869005ADD65 /* SBType.h in Headers */,
 				9475C18914E5EA08001BFC6D /* SBTypeCategory.h in Headers */,
 				941BCC7F14E48C4000BB969C /* SBTypeFilter.h in Headers */,
@@ -3613,6 +3612,7 @@
 				26FFC19E14FC072100087D58 /* DynamicLoaderPOSIXDYLD.h in Headers */,
 				AF254E32170CCC33007AE5C9 /* PlatformDarwinKernel.h in Headers */,
 				2694E99E14FC0BB30076DE67 /* PlatformFreeBSD.h in Headers */,
+				2635878C17822E20004C30BA /* SymbolVendorELF.h in Headers */,
 				2694E9A514FC0BBD0076DE67 /* PlatformLinux.h in Headers */,
 				2663E379152BD1890091EC22 /* ReadWriteLock.h in Headers */,
 				945759681534941F005A9070 /* PlatformPOSIX.h in Headers */,
@@ -3993,6 +3993,7 @@
 				4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */,
 				26B82840142D020F002DBC64 /* SBSection.cpp in Sources */,
 				B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */,
+				263C4938178B50C40070F12D /* SBModuleSpec.cpp in Sources */,
 				2660AAB914622483003A9694 /* LLDBWrapPython.cpp in Sources */,
 				9475C18814E5E9FA001BFC6D /* SBTypeCategory.cpp in Sources */,
 				9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */,
@@ -4307,7 +4308,6 @@
 				4CCA645813B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */,
 				9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */,
 				49D8FB3913B5598F00411094 /* ClangASTImporter.cpp in Sources */,
-				9467E65213C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp in Sources */,
 				26ED3D6D13C563810017D45E /* OptionGroupVariable.cpp in Sources */,
 				94611EB213CCA4A4003A22AF /* RefCounter.cpp in Sources */,
 				94031A9E13CF486700DCFF3C /* InputReaderEZ.cpp in Sources */,
@@ -4353,7 +4353,6 @@
 				945E8D80152F6AB40019BCCD /* StreamGDBRemote.cpp in Sources */,
 				945759671534941F005A9070 /* PlatformPOSIX.cpp in Sources */,
 				26B1EFAE154638AF00E2DAC7 /* DWARFDeclContext.cpp in Sources */,
-				B21EB71515CC99F100E60059 /* cxa_demangle.cpp in Sources */,
 				260CC64815D0440D002BF2E0 /* OptionValueArgs.cpp in Sources */,
 				260CC64915D0440D002BF2E0 /* OptionValueArray.cpp in Sources */,
 				260CC64A15D0440D002BF2E0 /* OptionValueBoolean.cpp in Sources */,
@@ -4682,9 +4681,9 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4739,10 +4738,10 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4797,7 +4796,7 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				DEBUGGING_SYMBOLS = YES;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -4823,7 +4822,7 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				OTHER_CFLAGS = "";
@@ -4840,7 +4839,7 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				OTHER_CFLAGS = "";
@@ -4854,8 +4853,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4883,8 +4882,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4912,8 +4911,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -5007,7 +5006,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5049,10 +5048,10 @@
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -5373,7 +5372,7 @@
 		26F5C26C10F3D9A5009D5894 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5403,7 +5402,7 @@
 		26F5C26D10F3D9A5009D5894 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5521,7 +5520,7 @@
 		49BB8F381611172B00BDD462 /* DebugClang */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5555,9 +5554,9 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -5622,8 +5621,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
-				DYLIB_CURRENT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
+				DYLIB_CURRENT_VERSION = 310.99.0;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -5789,7 +5788,7 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 300.99.0;
+				CURRENT_PROJECT_VERSION = 310.99.0;
 				DEBUGGING_SYMBOLS = YES;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/Run%20Testsuite.xcscheme?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme Wed Jul 17 17:17:41 2013
@@ -79,15 +79,16 @@
             isEnabled = "YES">
          </CommandLineArgument>
          <CommandLineArgument
-            argument = "-f"
-            isEnabled = "YES">
-         </CommandLineArgument>
-         <CommandLineArgument
-            argument = "ConditionalBreakTestCase.test_with_dwarf_command"
+            argument = "functionalities/breakpoint/breakpoint_conditions"
             isEnabled = "YES">
          </CommandLineArgument>
       </CommandLineArguments>
       <AdditionalOptions>
+         <AdditionalOption
+            key = "DYLD_INSERT_LIBRARIES"
+            value = "/usr/lib/libgmalloc.dylib"
+            isEnabled = "YES">
+         </AdditionalOption>
       </AdditionalOptions>
    </LaunchAction>
    <ProfileAction

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Wed Jul 17 17:17:41 2013
@@ -84,7 +84,7 @@
    <LaunchAction
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "1"
+      launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach"
       buildConfiguration = "Debug"

Modified: lldb/branches/lldb-platform-work/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/resources/LLDB-Info.plist?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/resources/LLDB-Info.plist (original)
+++ lldb/branches/lldb-platform-work/resources/LLDB-Info.plist Wed Jul 17 17:17:41 2013
@@ -17,7 +17,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>300.99.0</string>
+	<string>310.99.0</string>
 	<key>CFBundleName</key>
 	<string>${EXECUTABLE_NAME}</string>
 </dict>

Modified: lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh Wed Jul 17 17:17:41 2013
@@ -105,6 +105,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/l
 " ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\
 " ${SRC_ROOT}/include/lldb/API/SBListener.h"\
 " ${SRC_ROOT}/include/lldb/API/SBModule.h"\
+" ${SRC_ROOT}/include/lldb/API/SBModuleSpec.h"\
 " ${SRC_ROOT}/include/lldb/API/SBProcess.h"\
 " ${SRC_ROOT}/include/lldb/API/SBSourceManager.h"\
 " ${SRC_ROOT}/include/lldb/API/SBStream.h"\
@@ -150,6 +151,7 @@ INTERFACE_FILES="${SRC_ROOT}/scripts/Pyt
 " ${SRC_ROOT}/scripts/Python/interface/SBLineEntry.i"\
 " ${SRC_ROOT}/scripts/Python/interface/SBListener.i"\
 " ${SRC_ROOT}/scripts/Python/interface/SBModule.i"\
+" ${SRC_ROOT}/scripts/Python/interface/SBModuleSpec.i"\
 " ${SRC_ROOT}/scripts/Python/interface/SBProcess.i"\
 " ${SRC_ROOT}/scripts/Python/interface/SBSourceManager.i"\
 " ${SRC_ROOT}/scripts/Python/interface/SBStream.i"\

Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i Wed Jul 17 17:17:41 2013
@@ -62,10 +62,10 @@ public:
     void
     SetError (lldb::SBError &error,
               const char *fallback_error_cstr = NULL);
-
+    
     void
     SetError (const char *error_cstr);
-    
+
     lldb::ReturnStatus
     GetStatus();
 

Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i Wed Jul 17 17:17:41 2013
@@ -96,7 +96,9 @@ public:
 
     SBModule ();
 
-    SBModule (const SBModule &rhs);
+    SBModule (const lldb::SBModule &rhs);
+     
+    SBModule (const lldb::SBModuleSpec &module_spec);
     
     SBModule (lldb::SBProcess &process, 
               lldb::addr_t header_addr);

Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBTarget.i?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBTarget.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBTarget.i Wed Jul 17 17:17:41 2013
@@ -515,6 +515,9 @@ public:
                const char *uuid_cstr,
                const char *symfile);
 
+    lldb::SBModule
+    AddModule (const SBModuleSpec &module_spec);
+
     uint32_t
     GetNumModules () const;
 

Modified: lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig Wed Jul 17 17:17:41 2013
@@ -353,6 +353,37 @@
             return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
     %}
 }
+
+%extend lldb::SBModuleSpec {
+        PyObject *lldb::SBModuleSpec::__str__ (){
+                lldb::SBStream description;
+                $self->GetDescription (description);
+                const char *desc = description.GetData();
+                size_t desc_len = description.GetSize();
+                if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
+                    --desc_len;
+                if (desc_len > 0)
+                    return PyString_FromStringAndSize (desc, desc_len);
+                else
+                    return PyString_FromString("");
+        }
+}
+
+%extend lldb::SBModuleSpecList {
+        PyObject *lldb::SBModuleSpecList::__str__ (){
+                lldb::SBStream description;
+                $self->GetDescription (description);
+                const char *desc = description.GetData();
+                size_t desc_len = description.GetSize();
+                if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
+                    --desc_len;
+                if (desc_len > 0)
+                    return PyString_FromStringAndSize (desc, desc_len);
+                else
+                    return PyString_FromString("");
+        }
+}
+
 %extend lldb::SBProcess {
         PyObject *lldb::SBProcess::__str__ (){
                 lldb::SBStream description;

Modified: lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig Wed Jul 17 17:17:41 2013
@@ -1,988 +1,998 @@
-%wrapper %{
-
-class PyErr_Cleaner
-{
-public:
-    PyErr_Cleaner(bool print=false) :
-        m_print(print)
-    {
-    }
-
-    ~PyErr_Cleaner()
-    {
-        if (PyErr_Occurred())
-        {
-            if(m_print)
-                PyErr_Print();
-            PyErr_Clear();
-        }
-    }
-
-private:
-    bool m_print;
-};
-
-// resolve a dotted Python name in the form
-// foo.bar.baz.Foobar to an actual Python object
-// if pmodule is NULL, the __main__ module will be used
-// as the starting point for the search
-
-static PyObject*
-ResolvePythonName(const char* name,
-                  PyObject* pmodule = NULL)
-{
-    if (!name)
-        return pmodule;
-
-    PyErr_Cleaner pyerr_cleanup(true);  // show Python errors
-
-    PyObject* main_dict;
-
-    if (!pmodule)
-    {
-        pmodule = PyImport_AddModule ("__main__");
-        if (!pmodule)
-            return NULL;
-    }
-
-    if (PyType_Check(pmodule))
-    {
-        main_dict = ((PyTypeObject*)pmodule)->tp_dict;
-        if (!main_dict)
-            return NULL;
-    }
-    else if (!PyDict_Check(pmodule))
-    {
-        main_dict = PyModule_GetDict (pmodule);
-        if (!main_dict)
-            return NULL;
-    }
-    else
-        main_dict = pmodule;
-
-    const char* dot_pos = ::strchr(name, '.');
-
-    PyObject *dest_object;
-    PyObject *key, *value;
-    Py_ssize_t pos = 0;
-
-    if (!dot_pos)
-    {
-        dest_object = NULL;   
-        while (PyDict_Next (main_dict, &pos, &key, &value))
-        {
-            // We have stolen references to the key and value objects in the dictionary; we need to increment 
-            // them now so that Python's garbage collector doesn't collect them out from under us.
-            Py_INCREF (key);
-            Py_INCREF (value);
-            if (strcmp (PyString_AsString (key), name) == 0)
-            {
-                dest_object = value;
-                break;
-            }
-        }        
-        if (!dest_object || dest_object == Py_None)
-            return NULL;
-        return dest_object;
-    }
-    else
-    {
-        size_t len = dot_pos - name;
-        std::string piece(name,len);
-        pmodule = ResolvePythonName(piece.c_str(), main_dict);
-        if (!pmodule)
-            return NULL;
-        name = dot_pos+1;
-        return ResolvePythonName(dot_pos+1,pmodule); // tail recursion.. should be optimized by the compiler
-    }
-}
-
-static PyObject*
-FindSessionDictionary(const char *session_dictionary_name)
-{
-    return ResolvePythonName(session_dictionary_name, NULL);
-}
-
-class PyCallable
-{
-public:
-
-    operator
-    bool ()
-    {
-        return m_callable != NULL;
-    }
-
-    template<typename ...Args>
-    PyObject*
-    operator () (Args... args)
-    {
-        return (*this)({SBTypeToSWIGWrapper(args)...});
-    }
-    
-    PyObject*
-    operator () (std::initializer_list<PyObject*> args)
-    {
-        PyObject* retval = NULL;
-        PyObject* pargs = PyTuple_New (args.size());
-        if (pargs == NULL)
-        {
-            if (PyErr_Occurred())
-                PyErr_Clear();
-            return retval;
-        }
-        size_t idx = 0;
-        for (auto arg : args)
-        {
-            if (!arg)
-                return retval;
-            PyTuple_SetItem(pargs,idx,arg);
-            idx++;
-        }
-        retval = PyObject_CallObject (m_callable, pargs);
-        Py_XDECREF (pargs);
-        return retval;
-    }
-    
-    static PyCallable
-    FindWithPythonObject (PyObject* pfunc)
-    {
-        return PyCallable(pfunc);
-    }
-    
-    static PyCallable
-    FindWithFunctionName (const char *python_function_name,
-                          const char *session_dictionary_name)
-    {
-        if (!python_function_name || !session_dictionary_name)
-            return PyCallable();
-        if ( (python_function_name[0] == 0) || (session_dictionary_name[0] == 0) )
-            return PyCallable();
-        return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name));
-    }
-    
-    static PyCallable
-    FindWithFunctionName (const char *python_function_name,
-                          PyObject *session_dict)
-    {
-        if (!python_function_name || !session_dict)
-            return PyCallable();
-        if ( (python_function_name[0] == 0))
-            return PyCallable();
-        return PyCallable(ResolvePythonName (python_function_name, session_dict));
-    }
-
-    static PyCallable
-    FindWithMemberFunction (PyObject *self,
-                            const char *python_function_name)
-    {
-        if (self == NULL || self == Py_None)
-            return PyCallable();
-        if (!python_function_name || (python_function_name[0] == 0))
-            return PyCallable();
-        return PyCallable(PyObject_GetAttrString(self, python_function_name));
-    }
-
-private:
-    PyObject* m_callable;
-    
-    PyCallable (PyObject *callable = NULL) :
-    m_callable(callable)
-    {
-        if (m_callable && PyCallable_Check(m_callable) == false)
-            m_callable = NULL;
-    }
-};
-
-// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)
-// and is used when a script command is attached to a breakpoint for execution.
-
-SWIGEXPORT bool
-LLDBSwigPythonBreakpointCallbackFunction 
-(
-    const char *python_function_name,
-    const char *session_dictionary_name,
-    const lldb::StackFrameSP& frame_sp, 
-    const lldb::BreakpointLocationSP& bp_loc_sp
-)
-{
-    lldb::SBFrame sb_frame (frame_sp);
-    lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
-
-    bool stop_at_breakpoint = true;
-
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return stop_at_breakpoint;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        if (pvalue == Py_False)
-            stop_at_breakpoint = false;
-
-        Py_XDECREF (pvalue);
-    }
-    
-    return stop_at_breakpoint;
-}
-
-// This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...)
-// and is used when a script command is attached to a watchpoint for execution.
-
-SWIGEXPORT bool
-LLDBSwigPythonWatchpointCallbackFunction 
-(
-    const char *python_function_name,
-    const char *session_dictionary_name,
-    const lldb::StackFrameSP& frame_sp, 
-    const lldb::WatchpointSP& wp_sp
-)
-{
-    lldb::SBFrame sb_frame (frame_sp);
-    lldb::SBWatchpoint sb_wp(wp_sp);
-
-    bool stop_at_watchpoint = true;
-    
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return stop_at_watchpoint;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        if (pvalue == Py_False)
-            stop_at_watchpoint = false;
-        
-        Py_XDECREF (pvalue);
-    }
-    
-    return stop_at_watchpoint;
-}
-
-bool
-PyObjectToString (PyObject* object,
-                  std::string& retval)
-{
-    retval.clear();
-    bool was_ok = false;
-    if (object != NULL && object != Py_None)
-    {
-        if (PyString_Check(object))
-        {
-            retval.assign(PyString_AsString(object));
-            was_ok = true;
-        }
-        else
-        {
-            PyObject* value_as_string = PyObject_Str(object);
-            if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))
-            {
-                retval.assign(PyString_AsString(value_as_string));
-                was_ok = true;
-            }
-            Py_XDECREF(value_as_string);
-        }
-    }
-    return was_ok;
-}
-
-SWIGEXPORT bool
-LLDBSwigPythonCallTypeScript 
-(
-    const char *python_function_name,
-    const void *session_dictionary,
-    const lldb::ValueObjectSP& valobj_sp,
-    void** pyfunct_wrapper,
-    std::string& retval
-)
-{
-    lldb::SBValue sb_value (valobj_sp);
-
-    retval.clear();
-
-    if (!python_function_name || !session_dictionary)
-        return false;
-
-    PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL;
-    
-    if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper))
-    {
-        pfunc_impl = (PyObject*)(*pyfunct_wrapper);
-        if (pfunc_impl->ob_refcnt == 1)
-        {
-            Py_XDECREF(pfunc_impl);
-            pfunc_impl = NULL;
-        }
-    }
-
-    if (PyDict_Check(session_dict))
-    {
-        PyErr_Cleaner pyerr_cleanup(true);  // show Python errors
-        
-        if (!pfunc_impl)
-        {
-            pfunc_impl = ResolvePythonName (python_function_name, session_dict);
-            if (!pfunc_impl || !PyCallable_Check (pfunc_impl))
-                return false;
-            else
-            {
-                if (pyfunct_wrapper)
-                    *pyfunct_wrapper = pfunc_impl;
-            }
-        }
-        /*else
-            printf("caching works!!!!\n");*/
-        
-        PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl);
-        
-        if (!pfunc)
-            return false;
-        
-        pvalue = pfunc(sb_value,session_dict);
-
-        Py_INCREF (session_dict);
-        
-        PyObjectToString(pvalue,retval);
-        
-        Py_XDECREF (pvalue);
-    }
-    return true;
-}
-
-SWIGEXPORT void*
-LLDBSwigPythonCreateSyntheticProvider 
-(
-    const char *python_class_name,
-    const char *session_dictionary_name,
-    const lldb::ValueObjectSP& valobj_sp
-)
-{
-    PyObject* retval = NULL;
-
-    if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
-        Py_RETURN_NONE;
-
-    // I do not want the SBValue to be deallocated when going out of scope because python
-    // has ownership of it and will manage memory for this object by itself
-    lldb::SBValue *sb_value = new lldb::SBValue(valobj_sp);
-    sb_value->SetPreferSyntheticValue(false);
-    PyObject *ValObj_PyObj = SBTypeToSWIGWrapper(sb_value);
-
-    if (ValObj_PyObj == NULL)
-        Py_RETURN_NONE;
-    
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-        
-        Py_INCREF(ValObj_PyObj);
-        
-        PyObject* session_dict = NULL;
-        retval = pfunc(ValObj_PyObj, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        Py_XINCREF(retval);
-    }
-    
-    if (retval)
-        return retval;
-    else
-        Py_RETURN_NONE;
-}
-
-// wrapper that calls an optional instance member of an object taking no arguments
-static PyObject*
-LLDBSwigPython_CallOptionalMember
-(
-    PyObject* self,
-    char* callee_name,
-    PyObject* ret_if_not_found = Py_None,
-    bool* was_found = NULL
-)
-{
-    PyErr_Cleaner py_err_cleaner(false);
-    
-    PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name);
-    
-    if (!pfunc)
-    {
-        if (was_found)
-            *was_found = false;
-        Py_XINCREF(ret_if_not_found);
-        return ret_if_not_found;
-    }
-    
-    if (was_found)
-        *was_found = true;
-    
-    PyObject* py_return = pfunc();
-    return py_return;
-}
-
-SWIGEXPORT uint32_t
-LLDBSwigPython_CalculateNumChildren
-(
-    PyObject *implementor
-)
-{
-    uint32_t ret_val = UINT32_MAX;
-
-    static char callee_name[] = "num_children";
-
-    PyObject* py_return = LLDBSwigPython_CallOptionalMember(implementor,callee_name, NULL);
-
-    if (!py_return)
-        return ret_val;
-
-    if (PyInt_Check(py_return))
-        ret_val = PyInt_AsLong(py_return);
-
-    Py_XDECREF(py_return);
-    
-    if (PyErr_Occurred())
-    {
-        PyErr_Print();
-        PyErr_Clear();
-    }
-    
-    return ret_val;
-}
-
-SWIGEXPORT PyObject*
-LLDBSwigPython_GetChildAtIndex
-(
-    PyObject *implementor,
-    uint32_t idx
-)
-{
-    PyErr_Cleaner py_err_cleaner(true);
-    
-    PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index");
-    
-    if (!pfunc)
-        return NULL;
-    
-    PyObject *py_return = NULL;
-    py_return = pfunc(idx);
-    
-    if (py_return == NULL || py_return == Py_None)
-    {
-        Py_XDECREF(py_return);
-        return NULL;
-    }
-    
-    lldb::SBValue* sbvalue_ptr = NULL;
-    
-    if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)
-    {
-        Py_XDECREF(py_return);
-        return NULL;
-    }
-    
-    if (sbvalue_ptr == NULL)
-        return NULL;
-    
-    return py_return;    
-}
-
-SWIGEXPORT int
-LLDBSwigPython_GetIndexOfChildWithName
-(
-    PyObject *implementor,
-    const char* child_name
-)
-{
-    PyErr_Cleaner py_err_cleaner(true);
-    
-    PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index");
-    
-    if (!pfunc)
-        return UINT32_MAX;
-    
-    PyObject *py_return = NULL;
-    py_return = pfunc(child_name);
-    
-    if (py_return == NULL || py_return == Py_None)
-    {
-        Py_XDECREF(py_return);
-        return UINT32_MAX;
-    }
-    
-    long retval = PyInt_AsLong(py_return);
-    Py_XDECREF(py_return);
-
-    if (retval >= 0)
-        return (uint32_t)retval;
-    
-    return UINT32_MAX;
-}
-
-SWIGEXPORT bool
-LLDBSwigPython_UpdateSynthProviderInstance
-(
-    PyObject *implementor
-)
-{
-    bool ret_val = false;
-
-    static char callee_name[] = "update";
-
-    PyObject* py_return = LLDBSwigPython_CallOptionalMember(implementor,callee_name);
-
-    if (py_return == Py_True)
-        ret_val = true;
-
-    Py_XDECREF(py_return);
-    
-    return ret_val;
-}
-
-SWIGEXPORT bool
-LLDBSwigPython_MightHaveChildrenSynthProviderInstance
-(
-    PyObject *implementor
-)
-{
-    bool ret_val = false;
-
-    static char callee_name[] = "has_children";
-
-    PyObject* py_return = LLDBSwigPython_CallOptionalMember(implementor,callee_name, Py_True);
-
-    if (py_return == Py_True)
-        ret_val = true;
-
-    Py_XDECREF(py_return);
-    
-    return ret_val;
-}
-
-SWIGEXPORT void*
-LLDBSWIGPython_CastPyObjectToSBValue
-(
-    PyObject* data
-)
-{
-    lldb::SBValue* sb_ptr = NULL;
-    
-    int valid_cast = SWIG_ConvertPtr(data, (void**)&sb_ptr, SWIGTYPE_p_lldb__SBValue, 0);
-
-    if (valid_cast == -1)
-        return NULL;
-
-    return sb_ptr;
-}
-
-// Currently, SBCommandReturnObjectReleaser wraps a unique pointer to an
-// lldb_private::CommandReturnObject. This means that the destructor for the
-// SB object will deallocate its contained CommandReturnObject. Because that
-// object is used as the real return object for Python-based commands, we want
-// it to stay around. Thus, we release the unique pointer before returning from
-// LLDBSwigPythonCallCommand, and to guarantee that the release will occur no
-// matter how we exit from the function, we have a releaser object whose
-// destructor does the right thing for us
-class SBCommandReturnObjectReleaser
-{
-public:
-    SBCommandReturnObjectReleaser (lldb::SBCommandReturnObject &obj) :
-        m_command_return_object_ref (obj)
-    {
-    }
-
-    ~SBCommandReturnObjectReleaser ()
-    {
-        m_command_return_object_ref.Release();
-    }
-private:
-    lldb::SBCommandReturnObject &m_command_return_object_ref;
-};
-
-SWIGEXPORT bool
-LLDBSwigPythonCallCommand 
-(
-    const char *python_function_name,
-    const char *session_dictionary_name,
-    lldb::DebuggerSP& debugger,
-    const char* args,
-    lldb_private::CommandReturnObject& cmd_retobj
-)
-{
-
-    lldb::SBCommandReturnObject cmd_retobj_sb(&cmd_retobj);
-    SBCommandReturnObjectReleaser cmd_retobj_sb_releaser(cmd_retobj_sb);
-    lldb::SBDebugger debugger_sb(debugger);
-
-    bool retval = false;
-
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-
-        PyObject* session_dict = NULL;
-        // pass the pointer-to cmd_retobj_sb or watch the underlying object disappear from under you
-        // see comment above for SBCommandReturnObjectReleaser for further details
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        Py_XDECREF (pvalue);
-        
-        retval = true;
-    }
-    
-    return retval;
-}
-
-SWIGEXPORT void*
-LLDBSWIGPythonCreateOSPlugin
-(
-    const char *python_class_name,
-    const char *session_dictionary_name,
-    const lldb::ProcessSP& process_sp
-)
-{
-    PyObject* retval = NULL;
-
-    if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
-        Py_RETURN_NONE;
-
-    // I do not want the SBProcess to be deallocated when going out of scope because python
-    // has ownership of it and will manage memory for this object by itself
-    lldb::SBProcess *process_sb = new lldb::SBProcess(process_sp);
-
-    PyObject *SBProc_PyObj = SBTypeToSWIGWrapper(process_sb);
-
-    if (SBProc_PyObj == NULL)
-        Py_RETURN_NONE;
-
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-        
-        Py_INCREF(SBProc_PyObj);
-        
-        PyObject* session_dict = NULL;
-        session_dict = session_dict = FindSessionDictionary(session_dictionary_name);
-        retval = pfunc(SBProc_PyObj);
-        
-        Py_XINCREF (session_dict);
-        
-        Py_XINCREF(retval);
-    }
-    
-    if (retval)
-        return retval;
-    else
-        Py_RETURN_NONE;
-}
-
-SWIGEXPORT bool
-LLDBSWIGPythonRunScriptKeywordProcess
-(const char* python_function_name,
-const char* session_dictionary_name,
-lldb::ProcessSP& process,
-std::string& output)
-
-{
-    bool retval = false;
-
-    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
-        return retval;
-
-    lldb::SBProcess process_sb(process);
-
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        if (PyObjectToString(pvalue,output))
-            retval = true;
-        
-        Py_XDECREF(pvalue);
-    }
-    
-    return retval;
-}
-
-SWIGEXPORT bool
-LLDBSWIGPythonRunScriptKeywordThread
-(const char* python_function_name,
-const char* session_dictionary_name,
-lldb::ThreadSP& thread,
-std::string& output)
-
-{
-    bool retval = false;
-
-    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
-        return retval;
-
-    lldb::SBThread thread_sb(thread);
-    
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        if (PyObjectToString(pvalue,output))
-            retval = true;
-        
-        Py_XDECREF(pvalue);
-    }
-    
-    return retval;
-}
-
-SWIGEXPORT bool
-LLDBSWIGPythonRunScriptKeywordTarget
-(const char* python_function_name,
-const char* session_dictionary_name,
-lldb::TargetSP& target,
-std::string& output)
-
-{
-    bool retval = false;
-
-    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
-        return retval;
-
-    lldb::SBTarget target_sb(target);
-    
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        if (PyObjectToString(pvalue,output))
-            retval = true;
-        
-        Py_XDECREF(pvalue);
-    }
-    
-    return retval;
-}
-
-SWIGEXPORT bool
-LLDBSWIGPythonRunScriptKeywordFrame
-(const char* python_function_name,
-const char* session_dictionary_name,
-lldb::StackFrameSP& frame,
-std::string& output)
-
-{
-    bool retval = false;
-
-    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
-        return retval;
-
-    lldb::SBFrame frame_sb(frame);
-    
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return retval;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        if (PyObjectToString(pvalue,output))
-            retval = true;
-        
-        Py_XDECREF(pvalue);
-    }
-    
-    return retval;
-}
-
-SWIGEXPORT bool
-LLDBSwigPythonCallModuleInit 
-(
-    const char *python_module_name,
-    const char *session_dictionary_name,
-    lldb::DebuggerSP& debugger
-)
-{
-    bool retval = false;
-
-    lldb::SBDebugger debugger_sb(debugger);
-
-    std::string python_function_name_string = python_module_name;
-    python_function_name_string += ".__lldb_init_module";
-    const char* python_function_name = python_function_name_string.c_str();
-    
-    {
-        PyErr_Cleaner py_err_cleaner(true);
-        
-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
-        
-        if (!pfunc)
-            return true;
-        
-        PyObject* session_dict = NULL;
-        PyObject* pvalue = NULL;
-        pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name));
-        
-        Py_XINCREF (session_dict);
-        
-        retval = true;
-        
-        Py_XDECREF(pvalue);
-    }
-    
-    return retval;
-}
-%}
-
-
-%runtime %{
-// Forward declaration to be inserted at the start of LLDBWrapPython.h
-// I used runtime as a hack to make SWIG place it where it's needed.
-// This is needed to use LLDBSwigPythonCallSBInputReaderCallback in the
-// typemaps and in the extensions (SBInputReader.__del__()).
-#include "lldb/API/SBInputReader.h"
-#include "lldb/API/SBDebugger.h"
-#include "lldb/API/SBValue.h"
- 
-SWIGEXPORT lldb::ValueObjectSP
-LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data)
-{
-    lldb::ValueObjectSP valobj_sp;
-    if (data)
-    {
-        lldb::SBValue* sb_ptr = (lldb::SBValue *)data;
-        valobj_sp = sb_ptr->GetSP();
-    }
-    return valobj_sp;
-}
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-size_t
-LLDBSwigPythonCallSBInputReaderCallback(void *baton,
-                                        lldb::SBInputReader *reader,
-                                        lldb::InputReaderAction notification,
-                                        const char*bytes,
-                                        size_t bytes_len);
-
-void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton);
-
-#ifdef __cplusplus
-}
-#endif
-%}
-
-%wrapper %{
-// For the InputReader Callback functions
-SWIGEXPORT size_t
-LLDBSwigPythonCallSBInputReaderCallback(void *baton,
-                                        lldb::SBInputReader *reader,
-                                        lldb::InputReaderAction notification,
-                                        const char*bytes,
-                                        size_t bytes_len) {
-    if (baton != Py_None) {
-        SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-    
-        PyObject *py_InputReader = SBTypeToSWIGWrapper(reader);
-        PyObject *py_Notification = PyInt_FromLong(notification);
-        PyObject *py_Bytes = PyBytes_FromStringAndSize(bytes, bytes_len);
-    
-        PyObject *tuple = PyTuple_Pack(3, py_InputReader, py_Notification, py_Bytes);
-        PyObject *res = PyObject_Call(reinterpret_cast<PyObject*>(baton), tuple, NULL);
-        Py_XDECREF(tuple);
-        Py_XDECREF(py_InputReader);
-        Py_XDECREF(py_Notification);
-        Py_XDECREF(py_Bytes);
-    
-        if (res == NULL) {
-          PyObject *exc = PyErr_Occurred();
-          if (exc) {
-            ::puts("\nErroring out at LLDBSwigPythonCallSBInputReaderCallback");
-            PyErr_Print();
-          }
-          return 0;
-        }
-    
-        size_t result = 0;
-        // If the callback misbehaves and returns Py_None, assume it returned 0
-        if (res != Py_None)
-          result = static_cast<size_t>(PyInt_AsSsize_t(res));
-    
-        Py_XDECREF(res);
-        SWIG_PYTHON_THREAD_END_BLOCK;
-        return result;
-    }
-    return 0;
-}
-
-// For the LogOutputCallback functions
-void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton) {
-    if (baton != Py_None) {
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-      PyObject_CallFunction(reinterpret_cast<PyObject*>(baton), const_cast<char*>("s"), str);
-      SWIG_PYTHON_THREAD_END_BLOCK;
-    }
-}
-%}
+%header %{
+
+template <typename T>
+PyObject *
+SBTypeToSWIGWrapper (T* item);
+
+class PyErr_Cleaner
+{
+public:
+    PyErr_Cleaner(bool print=false) :
+    m_print(print)
+    {
+    }
+    
+    ~PyErr_Cleaner()
+    {
+        if (PyErr_Occurred())
+        {
+            if(m_print)
+                PyErr_Print();
+            PyErr_Clear();
+        }
+    }
+    
+private:
+    bool m_print;
+};
+
+static PyObject*
+ResolvePythonName(const char* name,
+                  PyObject* pmodule)
+{
+    if (!name)
+        return pmodule;
+
+    PyErr_Cleaner pyerr_cleanup(true);  // show Python errors
+
+    PyObject* main_dict;
+
+    if (!pmodule)
+    {
+        pmodule = PyImport_AddModule ("__main__");
+        if (!pmodule)
+            return NULL;
+    }
+
+    if (PyType_Check(pmodule))
+    {
+        main_dict = ((PyTypeObject*)pmodule)->tp_dict;
+        if (!main_dict)
+            return NULL;
+    }
+    else if (!PyDict_Check(pmodule))
+    {
+        main_dict = PyModule_GetDict (pmodule);
+        if (!main_dict)
+            return NULL;
+    }
+    else
+        main_dict = pmodule;
+
+    const char* dot_pos = ::strchr(name, '.');
+
+    PyObject *dest_object;
+    PyObject *key, *value;
+    Py_ssize_t pos = 0;
+
+    if (!dot_pos)
+    {
+        dest_object = NULL;   
+        while (PyDict_Next (main_dict, &pos, &key, &value))
+        {
+            // We have stolen references to the key and value objects in the dictionary; we need to increment 
+            // them now so that Python's garbage collector doesn't collect them out from under us.
+            Py_INCREF (key);
+            Py_INCREF (value);
+            if (strcmp (PyString_AsString (key), name) == 0)
+            {
+                dest_object = value;
+                break;
+            }
+        }        
+        if (!dest_object || dest_object == Py_None)
+            return NULL;
+        return dest_object;
+    }
+    else
+    {
+        size_t len = dot_pos - name;
+        std::string piece(name,len);
+        pmodule = ResolvePythonName(piece.c_str(), main_dict);
+        if (!pmodule)
+            return NULL;
+        name = dot_pos+1;
+        return ResolvePythonName(dot_pos+1,pmodule); // tail recursion.. should be optimized by the compiler
+    }
+}
+
+static PyObject*
+FindSessionDictionary(const char *session_dictionary_name)
+{
+    return ResolvePythonName(session_dictionary_name, NULL);
+}
+
+class PyCallable
+{
+public:
+    
+    operator
+    bool ()
+    {
+        return m_callable != NULL;
+    }
+    
+    template<typename ...Args>
+    PyObject*
+    operator () (Args... args)
+    {
+        return (*this)({SBTypeToSWIGWrapper(args)...});
+    }
+    
+    PyObject*
+    operator () (std::initializer_list<PyObject*> args)
+    {
+        PyObject* retval = NULL;
+        PyObject* pargs = PyTuple_New (args.size());
+        if (pargs == NULL)
+        {
+            if (PyErr_Occurred())
+                PyErr_Clear();
+            return retval;
+        }
+        size_t idx = 0;
+        for (auto arg : args)
+        {
+            if (!arg)
+                return retval;
+            PyTuple_SetItem(pargs,idx,arg);
+            idx++;
+        }
+        retval = PyObject_CallObject (m_callable, pargs);
+        Py_XDECREF (pargs);
+        return retval;
+    }
+    
+    static PyCallable
+    FindWithPythonObject (PyObject* pfunc)
+    {
+        return PyCallable(pfunc);
+    }
+    
+    static PyCallable
+    FindWithFunctionName (const char *python_function_name,
+                          const char *session_dictionary_name)
+    {
+        if (!python_function_name || !session_dictionary_name)
+            return PyCallable();
+        if ( (python_function_name[0] == 0) || (session_dictionary_name[0] == 0) )
+            return PyCallable();
+        return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name));
+    }
+    
+    static PyCallable
+    FindWithFunctionName (const char *python_function_name,
+                          PyObject *session_dict)
+    {
+        if (!python_function_name || !session_dict)
+            return PyCallable();
+        if ( (python_function_name[0] == 0))
+            return PyCallable();
+        return PyCallable(ResolvePythonName (python_function_name, session_dict));
+    }
+    
+    static PyCallable
+    FindWithMemberFunction (PyObject *self,
+                            const char *python_function_name)
+    {
+        if (self == NULL || self == Py_None)
+            return PyCallable();
+        if (!python_function_name || (python_function_name[0] == 0))
+            return PyCallable();
+        return PyCallable(PyObject_GetAttrString(self, python_function_name));
+    }
+    
+private:
+    PyObject* m_callable;
+    
+    PyCallable (PyObject *callable = NULL) :
+    m_callable(callable)
+    {
+        if (m_callable && PyCallable_Check(m_callable) == false)
+            m_callable = NULL;
+    }
+};
+
+%}
+
+%wrapper %{
+
+// resolve a dotted Python name in the form
+// foo.bar.baz.Foobar to an actual Python object
+// if pmodule is NULL, the __main__ module will be used
+// as the starting point for the search
+
+
+// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)
+// and is used when a script command is attached to a breakpoint for execution.
+
+SWIGEXPORT bool
+LLDBSwigPythonBreakpointCallbackFunction 
+(
+    const char *python_function_name,
+    const char *session_dictionary_name,
+    const lldb::StackFrameSP& frame_sp, 
+    const lldb::BreakpointLocationSP& bp_loc_sp
+)
+{
+    lldb::SBFrame sb_frame (frame_sp);
+    lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
+    
+    bool stop_at_breakpoint = true;
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return stop_at_breakpoint;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        if (pvalue == Py_False)
+            stop_at_breakpoint = false;
+        
+        Py_XDECREF (pvalue);
+    }
+    
+    return stop_at_breakpoint;
+}
+
+// This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...)
+// and is used when a script command is attached to a watchpoint for execution.
+
+SWIGEXPORT bool
+LLDBSwigPythonWatchpointCallbackFunction 
+(
+    const char *python_function_name,
+    const char *session_dictionary_name,
+    const lldb::StackFrameSP& frame_sp, 
+    const lldb::WatchpointSP& wp_sp
+)
+{
+    lldb::SBFrame sb_frame (frame_sp);
+    lldb::SBWatchpoint sb_wp(wp_sp);
+
+    bool stop_at_watchpoint = true;
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return stop_at_watchpoint;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        if (pvalue == Py_False)
+            stop_at_watchpoint = false;
+        
+        Py_XDECREF (pvalue);
+    }
+    
+    return stop_at_watchpoint;
+}
+
+bool
+PyObjectToString (PyObject* object,
+                  std::string& retval)
+{
+    retval.clear();
+    bool was_ok = false;
+    if (object != NULL && object != Py_None)
+    {
+        if (PyString_Check(object))
+        {
+            retval.assign(PyString_AsString(object));
+            was_ok = true;
+        }
+        else
+        {
+            PyObject* value_as_string = PyObject_Str(object);
+            if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))
+            {
+                retval.assign(PyString_AsString(value_as_string));
+                was_ok = true;
+            }
+            Py_XDECREF(value_as_string);
+        }
+    }
+    return was_ok;
+}
+
+SWIGEXPORT bool
+LLDBSwigPythonCallTypeScript 
+(
+    const char *python_function_name,
+    const void *session_dictionary,
+    const lldb::ValueObjectSP& valobj_sp,
+    void** pyfunct_wrapper,
+    std::string& retval
+)
+{
+    lldb::SBValue sb_value (valobj_sp);
+
+    retval.clear();
+
+    if (!python_function_name || !session_dictionary)
+        return false;
+
+    PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL;
+    
+    if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper))
+    {
+        pfunc_impl = (PyObject*)(*pyfunct_wrapper);
+        if (pfunc_impl->ob_refcnt == 1)
+        {
+            Py_XDECREF(pfunc_impl);
+            pfunc_impl = NULL;
+        }
+    }
+
+    if (PyDict_Check(session_dict))
+    {
+        PyErr_Cleaner pyerr_cleanup(true);  // show Python errors
+        
+        if (!pfunc_impl)
+        {
+            pfunc_impl = ResolvePythonName (python_function_name, session_dict);
+            if (!pfunc_impl || !PyCallable_Check (pfunc_impl))
+                return false;
+            else
+            {
+                if (pyfunct_wrapper)
+                    *pyfunct_wrapper = pfunc_impl;
+            }
+        }
+        /*else
+            printf("caching works!!!!\n");*/
+        
+        PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl);
+        
+        if (!pfunc)
+            return false;
+        
+        pvalue = pfunc(sb_value,session_dict);
+
+        Py_INCREF (session_dict);
+        
+        PyObjectToString(pvalue,retval);
+        
+        Py_XDECREF (pvalue);
+    }
+    return true;
+}
+
+SWIGEXPORT void*
+LLDBSwigPythonCreateSyntheticProvider 
+(
+    const char *python_class_name,
+    const char *session_dictionary_name,
+    const lldb::ValueObjectSP& valobj_sp
+)
+{
+    PyObject* retval = NULL;
+
+    if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
+        Py_RETURN_NONE;
+
+    // I do not want the SBValue to be deallocated when going out of scope because python
+    // has ownership of it and will manage memory for this object by itself
+    lldb::SBValue *sb_value = new lldb::SBValue(valobj_sp);
+    sb_value->SetPreferSyntheticValue(false);
+    PyObject *ValObj_PyObj = SBTypeToSWIGWrapper(sb_value);
+
+    if (ValObj_PyObj == NULL)
+        Py_RETURN_NONE;
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+        
+        Py_INCREF(ValObj_PyObj);
+        
+        PyObject* session_dict = NULL;
+        session_dict = FindSessionDictionary(session_dictionary_name);
+        retval = pfunc(sb_value, session_dict);
+        
+        Py_XINCREF (session_dict);
+        
+        Py_XINCREF(retval);
+    }
+    
+    if (retval)
+        return retval;
+    else
+        Py_RETURN_NONE;
+}
+
+// wrapper that calls an optional instance member of an object taking no arguments
+static PyObject*
+LLDBSwigPython_CallOptionalMember
+(
+    PyObject* self,
+    char* callee_name,
+    PyObject* ret_if_not_found = Py_None,
+    bool* was_found = NULL
+)
+{
+    PyErr_Cleaner py_err_cleaner(false);
+    
+    PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name);
+    
+    if (!pfunc)
+    {
+        if (was_found)
+            *was_found = false;
+        Py_XINCREF(ret_if_not_found);
+        return ret_if_not_found;
+    }
+    
+    if (was_found)
+        *was_found = true;
+    
+    PyObject* py_return = pfunc();
+    return py_return;
+}
+
+SWIGEXPORT uint32_t
+LLDBSwigPython_CalculateNumChildren
+(
+    PyObject *implementor
+)
+{
+    uint32_t ret_val = UINT32_MAX;
+
+    static char callee_name[] = "num_children";
+
+    PyObject* py_return = LLDBSwigPython_CallOptionalMember(implementor,callee_name, NULL);
+
+    if (!py_return)
+        return ret_val;
+
+    if (PyInt_Check(py_return))
+        ret_val = PyInt_AsLong(py_return);
+
+    Py_XDECREF(py_return);
+    
+    if (PyErr_Occurred())
+    {
+        PyErr_Print();
+        PyErr_Clear();
+    }
+    
+    return ret_val;
+}
+
+SWIGEXPORT PyObject*
+LLDBSwigPython_GetChildAtIndex
+(
+    PyObject *implementor,
+    uint32_t idx
+)
+{
+    PyErr_Cleaner py_err_cleaner(true);
+    
+    PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index");
+    
+    if (!pfunc)
+        return NULL;
+    
+    PyObject *py_return = NULL;
+    py_return = pfunc(idx);
+    
+    if (py_return == NULL || py_return == Py_None)
+    {
+        Py_XDECREF(py_return);
+        return NULL;
+    }
+    
+    lldb::SBValue* sbvalue_ptr = NULL;
+    
+    if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)
+    {
+        Py_XDECREF(py_return);
+        return NULL;
+    }
+    
+    if (sbvalue_ptr == NULL)
+        return NULL;
+    
+    return py_return;    
+}
+
+SWIGEXPORT int
+LLDBSwigPython_GetIndexOfChildWithName
+(
+    PyObject *implementor,
+    const char* child_name
+)
+{
+    PyErr_Cleaner py_err_cleaner(true);
+    
+    PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index");
+    
+    if (!pfunc)
+        return UINT32_MAX;
+    
+    PyObject *py_return = NULL;
+    py_return = pfunc(child_name);
+    
+    if (py_return == NULL || py_return == Py_None)
+    {
+        Py_XDECREF(py_return);
+        return UINT32_MAX;
+    }
+    
+    long retval = PyInt_AsLong(py_return);
+    Py_XDECREF(py_return);
+
+    if (retval >= 0)
+        return (uint32_t)retval;
+    
+    return UINT32_MAX;
+}
+
+SWIGEXPORT bool
+LLDBSwigPython_UpdateSynthProviderInstance
+(
+    PyObject *implementor
+)
+{
+    bool ret_val = false;
+
+    static char callee_name[] = "update";
+
+    PyObject* py_return = LLDBSwigPython_CallOptionalMember(implementor,callee_name);
+
+    if (py_return == Py_True)
+        ret_val = true;
+
+    Py_XDECREF(py_return);
+    
+    return ret_val;
+}
+
+SWIGEXPORT bool
+LLDBSwigPython_MightHaveChildrenSynthProviderInstance
+(
+    PyObject *implementor
+)
+{
+    bool ret_val = false;
+
+    static char callee_name[] = "has_children";
+
+    PyObject* py_return = LLDBSwigPython_CallOptionalMember(implementor,callee_name, Py_True);
+
+    if (py_return == Py_True)
+        ret_val = true;
+
+    Py_XDECREF(py_return);
+    
+    return ret_val;
+}
+
+SWIGEXPORT void*
+LLDBSWIGPython_CastPyObjectToSBValue
+(
+    PyObject* data
+)
+{
+    lldb::SBValue* sb_ptr = NULL;
+    
+    int valid_cast = SWIG_ConvertPtr(data, (void**)&sb_ptr, SWIGTYPE_p_lldb__SBValue, 0);
+
+    if (valid_cast == -1)
+        return NULL;
+
+    return sb_ptr;
+}
+
+// Currently, SBCommandReturnObjectReleaser wraps a unique pointer to an
+// lldb_private::CommandReturnObject. This means that the destructor for the
+// SB object will deallocate its contained CommandReturnObject. Because that
+// object is used as the real return object for Python-based commands, we want
+// it to stay around. Thus, we release the unique pointer before returning from
+// LLDBSwigPythonCallCommand, and to guarantee that the release will occur no
+// matter how we exit from the function, we have a releaser object whose
+// destructor does the right thing for us
+class SBCommandReturnObjectReleaser
+{
+public:
+    SBCommandReturnObjectReleaser (lldb::SBCommandReturnObject &obj) :
+        m_command_return_object_ref (obj)
+    {
+    }
+
+    ~SBCommandReturnObjectReleaser ()
+    {
+        m_command_return_object_ref.Release();
+    }
+private:
+    lldb::SBCommandReturnObject &m_command_return_object_ref;
+};
+
+SWIGEXPORT bool
+LLDBSwigPythonCallCommand 
+(
+    const char *python_function_name,
+    const char *session_dictionary_name,
+    lldb::DebuggerSP& debugger,
+    const char* args,
+    lldb_private::CommandReturnObject& cmd_retobj
+)
+{
+
+    lldb::SBCommandReturnObject cmd_retobj_sb(&cmd_retobj);
+    SBCommandReturnObjectReleaser cmd_retobj_sb_releaser(cmd_retobj_sb);
+    lldb::SBDebugger debugger_sb(debugger);
+
+    bool retval = false;
+
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+
+        PyObject* session_dict = NULL;
+        // pass the pointer-to cmd_retobj_sb or watch the underlying object disappear from under you
+        // see comment above for SBCommandReturnObjectReleaser for further details
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        Py_XDECREF (pvalue);
+        
+        retval = true;
+    }
+    
+    return retval;
+}
+
+SWIGEXPORT void*
+LLDBSWIGPythonCreateOSPlugin
+(
+    const char *python_class_name,
+    const char *session_dictionary_name,
+    const lldb::ProcessSP& process_sp
+)
+{
+    PyObject* retval = NULL;
+
+    if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
+        Py_RETURN_NONE;
+
+    // I do not want the SBProcess to be deallocated when going out of scope because python
+    // has ownership of it and will manage memory for this object by itself
+    lldb::SBProcess *process_sb = new lldb::SBProcess(process_sp);
+
+    PyObject *SBProc_PyObj = SBTypeToSWIGWrapper(process_sb);
+
+    if (SBProc_PyObj == NULL)
+        Py_RETURN_NONE;
+
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+        
+        Py_INCREF(SBProc_PyObj);
+        
+        PyObject* session_dict = NULL;
+        session_dict = session_dict = FindSessionDictionary(session_dictionary_name);
+        retval = pfunc(SBProc_PyObj);
+        
+        Py_XINCREF (session_dict);
+        
+        Py_XINCREF(retval);
+    }
+    
+    if (retval)
+        return retval;
+    else
+        Py_RETURN_NONE;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordProcess
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::ProcessSP& process,
+std::string& output)
+
+{
+    bool retval = false;
+
+    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
+        return retval;
+
+    lldb::SBProcess process_sb(process);
+
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        if (PyObjectToString(pvalue,output))
+            retval = true;
+        
+        Py_XDECREF(pvalue);
+    }
+    
+    return retval;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordThread
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::ThreadSP& thread,
+std::string& output)
+
+{
+    bool retval = false;
+
+    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
+        return retval;
+
+    lldb::SBThread thread_sb(thread);
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        if (PyObjectToString(pvalue,output))
+            retval = true;
+        
+        Py_XDECREF(pvalue);
+    }
+    
+    return retval;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordTarget
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::TargetSP& target,
+std::string& output)
+
+{
+    bool retval = false;
+
+    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
+        return retval;
+
+    lldb::SBTarget target_sb(target);
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        if (PyObjectToString(pvalue,output))
+            retval = true;
+        
+        Py_XDECREF(pvalue);
+    }
+    
+    return retval;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordFrame
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::StackFrameSP& frame,
+std::string& output)
+
+{
+    bool retval = false;
+
+    if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
+        return retval;
+
+    lldb::SBFrame frame_sb(frame);
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return retval;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        if (PyObjectToString(pvalue,output))
+            retval = true;
+        
+        Py_XDECREF(pvalue);
+    }
+    
+    return retval;
+}
+
+SWIGEXPORT bool
+LLDBSwigPythonCallModuleInit 
+(
+    const char *python_module_name,
+    const char *session_dictionary_name,
+    lldb::DebuggerSP& debugger
+)
+{
+    bool retval = false;
+
+    lldb::SBDebugger debugger_sb(debugger);
+
+    std::string python_function_name_string = python_module_name;
+    python_function_name_string += ".__lldb_init_module";
+    const char* python_function_name = python_function_name_string.c_str();
+    
+    {
+        PyErr_Cleaner py_err_cleaner(true);
+        
+        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+        
+        if (!pfunc)
+            return true;
+        
+        PyObject* session_dict = NULL;
+        PyObject* pvalue = NULL;
+        pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+        
+        Py_XINCREF (session_dict);
+        
+        retval = true;
+        
+        Py_XDECREF(pvalue);
+    }
+    
+    return retval;
+}
+%}
+
+
+%runtime %{
+// Forward declaration to be inserted at the start of LLDBWrapPython.h
+// I used runtime as a hack to make SWIG place it where it's needed.
+// This is needed to use LLDBSwigPythonCallSBInputReaderCallback in the
+// typemaps and in the extensions (SBInputReader.__del__()).
+#include "lldb/API/SBInputReader.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBValue.h"
+ 
+SWIGEXPORT lldb::ValueObjectSP
+LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data)
+{
+    lldb::ValueObjectSP valobj_sp;
+    if (data)
+    {
+        lldb::SBValue* sb_ptr = (lldb::SBValue *)data;
+        valobj_sp = sb_ptr->GetSP();
+    }
+    return valobj_sp;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+size_t
+LLDBSwigPythonCallSBInputReaderCallback(void *baton,
+                                        lldb::SBInputReader *reader,
+                                        lldb::InputReaderAction notification,
+                                        const char*bytes,
+                                        size_t bytes_len);
+
+void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton);
+
+#ifdef __cplusplus
+}
+#endif
+%}
+
+%wrapper %{
+// For the InputReader Callback functions
+SWIGEXPORT size_t
+LLDBSwigPythonCallSBInputReaderCallback(void *baton,
+                                        lldb::SBInputReader *reader,
+                                        lldb::InputReaderAction notification,
+                                        const char*bytes,
+                                        size_t bytes_len) {
+    if (baton != Py_None) {
+        SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+    
+        PyObject *py_InputReader = SBTypeToSWIGWrapper(reader);
+        PyObject *py_Notification = PyInt_FromLong(notification);
+        PyObject *py_Bytes = PyBytes_FromStringAndSize(bytes, bytes_len);
+    
+        PyObject *tuple = PyTuple_Pack(3, py_InputReader, py_Notification, py_Bytes);
+        PyObject *res = PyObject_Call(reinterpret_cast<PyObject*>(baton), tuple, NULL);
+        Py_XDECREF(tuple);
+        Py_XDECREF(py_InputReader);
+        Py_XDECREF(py_Notification);
+        Py_XDECREF(py_Bytes);
+    
+        if (res == NULL) {
+          PyObject *exc = PyErr_Occurred();
+          if (exc) {
+            ::puts("\nErroring out at LLDBSwigPythonCallSBInputReaderCallback");
+            PyErr_Print();
+          }
+          return 0;
+        }
+    
+        size_t result = 0;
+        // If the callback misbehaves and returns Py_None, assume it returned 0
+        if (res != Py_None)
+          result = static_cast<size_t>(PyInt_AsSsize_t(res));
+    
+        Py_XDECREF(res);
+        SWIG_PYTHON_THREAD_END_BLOCK;
+        return result;
+    }
+    return 0;
+}
+
+// For the LogOutputCallback functions
+void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton) {
+    if (baton != Py_None) {
+      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+      PyObject_CallFunction(reinterpret_cast<PyObject*>(baton), const_cast<char*>("s"), str);
+      SWIG_PYTHON_THREAD_END_BLOCK;
+    }
+}
+%}

Modified: lldb/branches/lldb-platform-work/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/lldb.swig?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/lldb.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/lldb.swig Wed Jul 17 17:17:41 2013
@@ -78,6 +78,7 @@ import os
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBListener.h"
 #include "lldb/API/SBModule.h"
+#include "lldb/API/SBModuleSpec.h"
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBSection.h"
 #include "lldb/API/SBSourceManager.h"
@@ -141,6 +142,7 @@ import os
 %include "./Python/interface/SBLineEntry.i"
 %include "./Python/interface/SBListener.i"
 %include "./Python/interface/SBModule.i"
+%include "./Python/interface/SBModuleSpec.i"
 %include "./Python/interface/SBProcess.i"
 %include "./Python/interface/SBSection.i"
 %include "./Python/interface/SBSourceManager.i"

Modified: lldb/branches/lldb-platform-work/source/API/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/CMakeLists.txt?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/API/CMakeLists.txt Wed Jul 17 17:17:41 2013
@@ -27,6 +27,7 @@ add_lldb_library(lldbAPI
   SBLineEntry.cpp
   SBListener.cpp
   SBModule.cpp
+  SBModuleSpec.cpp
   SBProcess.cpp
   SBSection.cpp
   SBSourceManager.cpp

Modified: lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp Wed Jul 17 17:17:41 2013
@@ -349,3 +349,4 @@ SBCommandReturnObject::SetError (const c
     if (m_opaque_ap.get() && error_cstr)
         m_opaque_ap->SetError(error_cstr);
 }
+

Modified: lldb/branches/lldb-platform-work/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBFileSpec.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBFileSpec.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBFileSpec.cpp Wed Jul 17 17:17:41 2013
@@ -21,25 +21,18 @@ using namespace lldb_private;
 
 
 SBFileSpec::SBFileSpec () :
-    m_opaque_ap()
+    m_opaque_ap(new lldb_private::FileSpec())
 {
 }
 
 SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
-    m_opaque_ap()
+    m_opaque_ap(new lldb_private::FileSpec(*rhs.m_opaque_ap))
 {
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
-    if (rhs.m_opaque_ap.get())
-        m_opaque_ap.reset (new FileSpec (rhs.get()));
+}
 
-    if (log)
-    {
-        SBStream sstr;
-        GetDescription (sstr);
-        log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => SBFileSpec(%p): %s",
-                     rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData());
-    }
+SBFileSpec::SBFileSpec (const lldb_private::FileSpec& fspec) :
+    m_opaque_ap(new lldb_private::FileSpec(fspec))
+{
 }
 
 // Deprected!!!
@@ -51,11 +44,6 @@ SBFileSpec::SBFileSpec (const char *path
 SBFileSpec::SBFileSpec (const char *path, bool resolve) :
     m_opaque_ap(new FileSpec (path, resolve))
 {
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
-    if (log)
-        log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path, 
-                     resolve, m_opaque_ap.get());
 }
 
 SBFileSpec::~SBFileSpec ()
@@ -66,17 +54,14 @@ const SBFileSpec &
 SBFileSpec::operator = (const SBFileSpec &rhs)
 {
     if (this != &rhs)
-    {
-        if (rhs.IsValid())
-            m_opaque_ap.reset (new lldb_private::FileSpec(*rhs.m_opaque_ap.get()));
-    }
+        *m_opaque_ap = *rhs.m_opaque_ap;
     return *this;
 }
 
 bool
 SBFileSpec::IsValid() const
 {
-    return m_opaque_ap.get() != NULL;
+    return *m_opaque_ap;
 }
 
 bool
@@ -84,9 +69,7 @@ SBFileSpec::Exists () const
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    bool result = false;
-    if (m_opaque_ap.get())
-        result = m_opaque_ap->Exists();
+    bool result = m_opaque_ap->Exists();
 
     if (log)
         log->Printf ("SBFileSpec(%p)::Exists () => %s", m_opaque_ap.get(), (result ? "true" : "false"));
@@ -97,9 +80,7 @@ SBFileSpec::Exists () const
 bool
 SBFileSpec::ResolveExecutableLocation ()
 {
-    if (m_opaque_ap.get())
-        return m_opaque_ap->ResolveExecutableLocation ();
-    return false;
+    return m_opaque_ap->ResolveExecutableLocation ();
 }
 
 int
@@ -111,9 +92,7 @@ SBFileSpec::ResolvePath (const char *src
 const char *
 SBFileSpec::GetFilename() const
 {
-    const char *s = NULL;
-    if (m_opaque_ap.get())
-        s = m_opaque_ap->GetFilename().AsCString();
+    const char *s = m_opaque_ap->GetFilename().AsCString();
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -130,9 +109,7 @@ SBFileSpec::GetFilename() const
 const char *
 SBFileSpec::GetDirectory() const
 {
-    const char *s = NULL;
-    if (m_opaque_ap.get())
-        s = m_opaque_ap->GetDirectory().AsCString();
+    const char *s = m_opaque_ap->GetDirectory().AsCString();
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
@@ -149,9 +126,7 @@ SBFileSpec::GetPath (char *dst_path, siz
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    uint32_t result = 0;
-    if (m_opaque_ap.get())
-        result = m_opaque_ap->GetPath (dst_path, dst_len);
+    uint32_t result = m_opaque_ap->GetPath (dst_path, dst_len);
 
     if (log)
         log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%" PRIu64 ") => %u",
@@ -192,24 +167,15 @@ SBFileSpec::ref() const
 void
 SBFileSpec::SetFileSpec (const lldb_private::FileSpec& fs)
 {
-    if (m_opaque_ap.get())
-        *m_opaque_ap = fs;
-    else
-        m_opaque_ap.reset (new FileSpec (fs));
+    *m_opaque_ap = fs;
 }
 
 bool
 SBFileSpec::GetDescription (SBStream &description) const
 {
     Stream &strm = description.ref();
-    if (m_opaque_ap.get())
-    {
-        char path[PATH_MAX];
-        if (m_opaque_ap->GetPath(path, sizeof(path)))
-            strm.PutCString (path);
-    }
-    else
-        strm.PutCString ("No value");
-    
+    char path[PATH_MAX];
+    if (m_opaque_ap->GetPath(path, sizeof(path)))
+        strm.PutCString (path);    
     return true;
 }

Modified: lldb/branches/lldb-platform-work/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBModule.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBModule.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBModule.cpp Wed Jul 17 17:17:41 2013
@@ -10,6 +10,7 @@
 #include "lldb/API/SBModule.h"
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBModuleSpec.h"
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/API/SBSymbolContextList.h"
@@ -39,6 +40,19 @@ SBModule::SBModule (const lldb::ModuleSP
 {
 }
 
+SBModule::SBModule(const SBModuleSpec &module_spec) :
+    m_opaque_sp ()
+{
+    ModuleSP module_sp;
+    Error error = ModuleList::GetSharedModule (*module_spec.m_opaque_ap,
+                                               module_sp,
+                                               NULL,
+                                               NULL,
+                                               NULL);
+    if (module_sp)
+        SetSP(module_sp);
+}
+
 SBModule::SBModule(const SBModule &rhs) :
     m_opaque_sp (rhs.m_opaque_sp)
 {
@@ -392,7 +406,7 @@ SBModule::GetNumSections ()
     {
         // Give the symbol vendor a chance to add to the unified section list.
         module_sp->GetSymbolVendor();
-        SectionList *section_list = module_sp->GetUnifiedSectionList();
+        SectionList *section_list = module_sp->GetSectionList();
         if (section_list)
             return section_list->GetSize();
     }
@@ -408,7 +422,7 @@ SBModule::GetSectionAtIndex (size_t idx)
     {
         // Give the symbol vendor a chance to add to the unified section list.
         module_sp->GetSymbolVendor();
-        SectionList *section_list = module_sp->GetUnifiedSectionList ();
+        SectionList *section_list = module_sp->GetSectionList ();
 
         if (section_list)
             sb_section.SetSP(section_list->GetSectionAtIndex (idx));
@@ -492,7 +506,7 @@ SBModule::FindFirstType (const char *nam
         sb_type = SBType (module_sp->FindFirstType(sc, name, exact_match));
         
         if (!sb_type.IsValid())
-            sb_type = SBType (ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
+            sb_type = SBType (ClangASTContext::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
     }
     return sb_type;
 }
@@ -502,7 +516,7 @@ SBModule::GetBasicType(lldb::BasicType t
 {
     ModuleSP module_sp (GetSP ());
     if (module_sp)
-        return SBType (ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), type));
+        return SBType (ClangASTContext::GetBasicType (module_sp->GetClangASTContext().getASTContext(), type));
     return SBType();
 }
 
@@ -535,7 +549,7 @@ SBModule::FindTypes (const char *type)
         }
         else
         {
-            SBType sb_type(ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
+            SBType sb_type(ClangASTContext::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
             if (sb_type.IsValid())
                 retval.Append(sb_type);
         }
@@ -573,7 +587,7 @@ SBModule::FindSection (const char *sect_
     {
         // Give the symbol vendor a chance to add to the unified section list.
         module_sp->GetSymbolVendor();
-        SectionList *section_list = module_sp->GetUnifiedSectionList();
+        SectionList *section_list = module_sp->GetSectionList();
         if (section_list)
         {
             ConstString const_sect_name(sect_name);

Modified: lldb/branches/lldb-platform-work/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBTarget.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBTarget.cpp Wed Jul 17 17:17:41 2013
@@ -19,6 +19,7 @@
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBListener.h"
 #include "lldb/API/SBModule.h"
+#include "lldb/API/SBModuleSpec.h"
 #include "lldb/API/SBSourceManager.h"
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBStream.h"
@@ -1913,6 +1914,16 @@ SBTarget::AddModule (const char *path,
     return sb_module;
 }
 
+lldb::SBModule
+SBTarget::AddModule (const SBModuleSpec &module_spec)
+{
+    lldb::SBModule sb_module;
+    TargetSP target_sp(GetSP());
+    if (target_sp)
+        sb_module.SetSP(target_sp->GetSharedModule (*module_spec.m_opaque_ap));
+    return sb_module;
+}
+
 bool
 SBTarget::AddModule (lldb::SBModule &module)
 {
@@ -2142,7 +2153,7 @@ SBTarget::FindFirstType (const char* typ
         // No matches, search for basic typename matches
         ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
         if (clang_ast)
-            return SBType (ClangASTType::GetBasicType (clang_ast->getASTContext(), const_typename));
+            return SBType (ClangASTContext::GetBasicType (clang_ast->getASTContext(), const_typename));
     }
     return SBType();
 }
@@ -2155,7 +2166,7 @@ SBTarget::GetBasicType(lldb::BasicType t
     {
         ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
         if (clang_ast)
-            return SBType (ClangASTType::GetBasicType (clang_ast->getASTContext(), type));
+            return SBType (ClangASTContext::GetBasicType (clang_ast->getASTContext(), type));
     }
     return SBType();
 }
@@ -2222,7 +2233,7 @@ SBTarget::FindTypes (const char* typenam
             // No matches, search for basic typename matches
             ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
             if (clang_ast)
-                sb_type_list.Append (SBType (ClangASTType::GetBasicType (clang_ast->getASTContext(), const_typename)));
+                sb_type_list.Append (SBType (ClangASTContext::GetBasicType (clang_ast->getASTContext(), const_typename)));
         }
     }
     return sb_type_list;

Modified: lldb/branches/lldb-platform-work/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBType.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBType.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBType.cpp Wed Jul 17 17:17:41 2013
@@ -142,7 +142,7 @@ SBType::GetByteSize()
     if (!IsValid())
         return 0;
     
-    return ClangASTType::GetTypeByteSize(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+    return m_opaque_sp->GetClangASTType().GetByteSize();
     
 }
 
@@ -151,13 +151,7 @@ SBType::IsPointerType()
 {
     if (!IsValid())
         return false;
-    
-    QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
-    const clang::Type* typePtr = qt.getTypePtrOrNull();
-    
-    if (typePtr)
-        return typePtr->isAnyPointerType();
-    return false;
+    return m_opaque_sp->GetClangASTType().IsPointerType();
 }
 
 bool
@@ -165,13 +159,7 @@ SBType::IsReferenceType()
 {
     if (!IsValid())
         return false;
-
-    QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
-    const clang::Type* typePtr = qt.getTypePtrOrNull();
-    
-    if (typePtr)
-        return typePtr->isReferenceType();
-    return false;
+    return m_opaque_sp->GetClangASTType().IsReferenceType();
 }
 
 SBType
@@ -180,8 +168,7 @@ SBType::GetPointerType()
     if (!IsValid())
         return SBType();
 
-    return SBType(ClangASTType(m_opaque_sp->GetASTContext(),
-                               ClangASTContext::CreatePointerType(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType())));
+    return SBType(ClangASTType(m_opaque_sp->GetClangASTType().GetPointerType()));
 }
 
 SBType
@@ -189,13 +176,7 @@ SBType::GetPointeeType()
 {
     if (!IsValid())
         return SBType();
-
-    QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
-    const clang::Type* typePtr = qt.getTypePtrOrNull();
-    
-    if (typePtr)
-        return SBType(ClangASTType(m_opaque_sp->GetASTContext(),typePtr->getPointeeType().getAsOpaquePtr()));
-    return SBType();
+    return SBType(ClangASTType(m_opaque_sp->GetClangASTType().GetPointeeType()));
 }
 
 SBType
@@ -203,9 +184,7 @@ SBType::GetReferenceType()
 {
     if (!IsValid())
         return SBType();
-    
-    return SBType(ClangASTType(m_opaque_sp->GetASTContext(),
-                               ClangASTContext::CreateLValueReferenceType(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType())));
+    return SBType(ClangASTType(m_opaque_sp->GetClangASTType().GetLValueReferenceType()));
 }
 
 SBType
@@ -213,32 +192,23 @@ SBType::GetDereferencedType()
 {
     if (!IsValid())
         return SBType();
-
-    QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
-    
-    return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getNonReferenceType().getAsOpaquePtr()));
+    return SBType(ClangASTType(m_opaque_sp->GetClangASTType().GetNonReferenceType()));
 }
 
 bool 
 SBType::IsFunctionType ()
 {
-    if (IsValid())
-    {
-        QualType qual_type(QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType()));
-        const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
-        return func != NULL;
-    }
-    return false;
+    if (!IsValid())
+        return false;
+    return m_opaque_sp->GetClangASTType().IsFunctionType();
 }
 
 bool
 SBType::IsPolymorphicClass ()
 {
-    if (IsValid())
-    {
-        return ClangASTType::IsPolymorphicClass (m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
-    }
-    return false;
+    if (!IsValid())
+        return false;
+    return m_opaque_sp->GetClangASTType().IsPolymorphicClass();
 }
 
 
@@ -248,12 +218,9 @@ SBType::GetFunctionReturnType ()
 {
     if (IsValid())
     {
-        QualType qual_type(QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType()));
-        const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
-        
-        if (func)
-            return SBType(ClangASTType(m_opaque_sp->GetASTContext(),
-                                       func->getResultType().getAsOpaquePtr()));
+        ClangASTType return_clang_type (m_opaque_sp->GetClangASTType().GetFunctionReturnType());
+        if (return_clang_type.IsValid())
+            return SBType(return_clang_type);
     }
     return lldb::SBType();
 }
@@ -281,19 +248,14 @@ SBType::GetUnqualifiedType()
 {
     if (!IsValid())
         return SBType();
-        
-    QualType qt (QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType()));
-    return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getUnqualifiedType().getAsOpaquePtr()));
+    return SBType(m_opaque_sp->GetClangASTType().GetFullyUnqualifiedType());
 }
 
 lldb::SBType
 SBType::GetCanonicalType()
 {
     if (IsValid())
-    {
-        QualType qt (QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType()));
-        return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getCanonicalType().getAsOpaquePtr()));
-    }
+        return SBType(m_opaque_sp->GetClangASTType().GetCanonicalType());
     return SBType();
 }
 
@@ -302,15 +264,15 @@ lldb::BasicType
 SBType::GetBasicType()
 {
     if (IsValid())
-        return ClangASTContext::GetLLDBBasicTypeEnumeration (m_opaque_sp->GetOpaqueQualType());
+        return m_opaque_sp->GetClangASTType().GetBasicTypeEnumeration ();
     return eBasicTypeInvalid;
 }
 
 SBType
-SBType::GetBasicType(lldb::BasicType type)
+SBType::GetBasicType(lldb::BasicType basic_type)
 {
     if (IsValid())
-        return SBType (ClangASTType::GetBasicType (m_opaque_sp->GetASTContext(), type));
+        return SBType (ClangASTContext::GetBasicType (m_opaque_sp->GetASTContext(), basic_type));
     return SBType();
 }
 
@@ -318,7 +280,7 @@ uint32_t
 SBType::GetNumberOfDirectBaseClasses ()
 {
     if (IsValid())
-        return ClangASTContext::GetNumDirectBaseClasses(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+        return m_opaque_sp->GetClangASTType().GetNumDirectBaseClasses();
     return 0;
 }
 
@@ -326,7 +288,7 @@ uint32_t
 SBType::GetNumberOfVirtualBaseClasses ()
 {
     if (IsValid())
-        return ClangASTContext::GetNumVirtualBaseClasses(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+        return m_opaque_sp->GetClangASTType().GetNumVirtualBaseClasses();
     return 0;
 }
 
@@ -334,7 +296,7 @@ uint32_t
 SBType::GetNumberOfFields ()
 {
     if (IsValid())
-        return ClangASTContext::GetNumFields(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+        return m_opaque_sp->GetClangASTType().GetNumFields();
     return 0;
 }
 
@@ -361,13 +323,15 @@ SBType::GetDirectBaseClassAtIndex (uint3
     SBTypeMember sb_type_member;
     if (IsValid())
     {
-        clang::ASTContext* ast = m_opaque_sp->GetASTContext();
-        uint32_t bit_offset = 0;
-        clang_type_t clang_type = ClangASTContext::GetDirectBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &bit_offset);
-        if (clang_type)
+        ClangASTType this_type (m_opaque_sp->GetClangASTType ());
+        if (this_type.IsValid())
         {
-            TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
-            sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset));
+            uint32_t bit_offset = 0;
+            ClangASTType base_class_type (this_type.GetDirectBaseClassAtIndex(idx, &bit_offset));
+            if (base_class_type.IsValid())
+            {
+                sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
+            }
         }
     }
     return sb_type_member;
@@ -380,14 +344,16 @@ SBType::GetVirtualBaseClassAtIndex (uint
     SBTypeMember sb_type_member;
     if (IsValid())
     {
-        uint32_t bit_offset = 0;
-        clang::ASTContext* ast = m_opaque_sp->GetASTContext();
-        clang_type_t clang_type = ClangASTContext::GetVirtualBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &bit_offset);
-        if (clang_type)
+        ClangASTType this_type (m_opaque_sp->GetClangASTType ());
+        if (this_type.IsValid())
         {
-            TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
-            sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset));
-        }        
+            uint32_t bit_offset = 0;
+            ClangASTType base_class_type (this_type.GetVirtualBaseClassAtIndex(idx, &bit_offset));
+            if (base_class_type.IsValid())
+            {
+                sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
+            }
+        }
     }
     return sb_type_member;
 }
@@ -398,20 +364,30 @@ SBType::GetFieldAtIndex (uint32_t idx)
     SBTypeMember sb_type_member;
     if (IsValid())
     {
-        uint64_t bit_offset = 0;
-        uint32_t bitfield_bit_size = 0;
-        bool is_bitfield = false;
-        clang::ASTContext* ast = m_opaque_sp->GetASTContext();
-        std::string name_sstr;
-        clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &bit_offset, &bitfield_bit_size, &is_bitfield);
-        if (clang_type)
+        ClangASTType this_type (m_opaque_sp->GetClangASTType ());
+        if (this_type.IsValid())
         {
-            ConstString name;
-            if (!name_sstr.empty())
-                name.SetCString(name_sstr.c_str());
-            TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
-            sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset, name, bitfield_bit_size, is_bitfield));
-        }        
+            uint64_t bit_offset = 0;
+            uint32_t bitfield_bit_size = 0;
+            bool is_bitfield = false;
+            std::string name_sstr;
+            ClangASTType field_type (this_type.GetFieldAtIndex (idx,
+                                                                name_sstr,
+                                                                &bit_offset,
+                                                                &bitfield_bit_size,
+                                                                &is_bitfield));
+            if (field_type.IsValid())
+            {
+                ConstString name;
+                if (!name_sstr.empty())
+                    name.SetCString(name_sstr.c_str());
+                sb_type_member.reset (new TypeMemberImpl (TypeImplSP (new TypeImpl(field_type)),
+                                                          bit_offset,
+                                                          name,
+                                                          bitfield_bit_size,
+                                                          is_bitfield));
+            }
+        }
     }
     return sb_type_member;
 }
@@ -420,9 +396,8 @@ bool
 SBType::IsTypeComplete()
 {
     if (!IsValid())
-        return false;
-    
-    return ClangASTContext::IsCompleteType(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+        return false;    
+    return m_opaque_sp->GetClangASTType().IsCompleteType();
 }
 
 const char*
@@ -430,17 +405,14 @@ SBType::GetName()
 {
     if (!IsValid())
         return "";
-
-    return ClangASTType::GetConstTypeName(m_opaque_sp->GetASTContext(),
-                                          m_opaque_sp->GetOpaqueQualType()).GetCString();
+    return m_opaque_sp->GetClangASTType().GetConstTypeName().GetCString();
 }
 
 lldb::TypeClass
 SBType::GetTypeClass ()
 {
     if (IsValid())
-        return ClangASTType::GetTypeClass (m_opaque_sp->GetASTContext(),
-                                           m_opaque_sp->GetOpaqueQualType());
+        return m_opaque_sp->GetClangASTType().GetTypeClass();
     return lldb::eTypeClassInvalid;
 }
 
@@ -448,10 +420,7 @@ uint32_t
 SBType::GetNumberOfTemplateArguments ()
 {
     if (IsValid())
-    {
-        return ClangASTContext::GetNumTemplateArguments (m_opaque_sp->GetASTContext(),
-                                                         m_opaque_sp->GetOpaqueQualType());
-    }
+        return m_opaque_sp->GetClangASTType().GetNumTemplateArguments();
     return 0;
 }
 
@@ -461,11 +430,9 @@ SBType::GetTemplateArgumentType (uint32_
     if (IsValid())
     {
         TemplateArgumentKind kind = eTemplateArgumentKindNull;
-        return SBType(ClangASTType(m_opaque_sp->GetASTContext(),
-                                   ClangASTContext::GetTemplateArgument(m_opaque_sp->GetASTContext(),
-                                                                        m_opaque_sp->GetOpaqueQualType(), 
-                                                                        idx, 
-                                                                        kind)));
+        ClangASTType template_arg_type = m_opaque_sp->GetClangASTType().GetTemplateArgument (idx, kind);
+        if (template_arg_type.IsValid())
+            return SBType(template_arg_type);
     }
     return SBType();
 }
@@ -476,18 +443,11 @@ SBType::GetTemplateArgumentKind (uint32_
 {
     TemplateArgumentKind kind = eTemplateArgumentKindNull;
     if (IsValid())
-    {
-        ClangASTContext::GetTemplateArgument(m_opaque_sp->GetASTContext(),
-                                             m_opaque_sp->GetOpaqueQualType(), 
-                                             idx, 
-                                             kind);
-    }
+        m_opaque_sp->GetClangASTType().GetTemplateArgument (idx, kind);
     return kind;
 }
 
 
-
-
 SBTypeList::SBTypeList() :
     m_opaque_ap(new TypeListImpl())
 {
@@ -543,20 +503,6 @@ SBTypeList::~SBTypeList()
 {
 }
 
-bool
-SBType::IsPointerType (void *opaque_type)
-{
-    Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-    
-    bool ret_value = ClangASTContext::IsPointerType (opaque_type);
-    
-    if (log)
-        log->Printf ("SBType::IsPointerType (opaque_type=%p) ==> '%s'", opaque_type, (ret_value ? "true" : "false"));
-    
-    return ret_value;
-}
-
-
 SBTypeMember::SBTypeMember() :
     m_opaque_ap()
 {

Modified: lldb/branches/lldb-platform-work/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBValue.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBValue.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBValue.cpp Wed Jul 17 17:17:41 2013
@@ -473,7 +473,7 @@ SBValue::GetType()
     TypeImplSP type_sp;
     if (value_sp)
     {
-        type_sp.reset (new TypeImpl(ClangASTType (value_sp->GetClangAST(), value_sp->GetClangType())));
+        type_sp.reset (new TypeImpl(value_sp->GetClangType()));
         sb_type.SetSP(type_sp);
     }
     if (log)
@@ -761,17 +761,14 @@ SBValue::CreateValueFromAddress(const ch
     lldb::TypeImplSP type_impl_sp (sb_type.GetSP());
     if (value_sp && type_impl_sp)
     {
-        ClangASTType pointee_ast_type(type_impl_sp->GetASTContext(), type_impl_sp->GetClangASTType().GetPointerType ());
-        lldb::TypeImplSP pointee_type_impl_sp (new TypeImpl(pointee_ast_type));
-        if (pointee_type_impl_sp)
+        ClangASTType pointee_ast_type(type_impl_sp->GetClangASTType().GetPointerType ());
+        if (pointee_ast_type)
         {
-            
             lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
             
             ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
             ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                                               pointee_type_impl_sp->GetASTContext(),
-                                                                               pointee_type_impl_sp->GetOpaqueQualType(),
+                                                                               pointee_ast_type,
                                                                                ConstString(name),
                                                                                buffer,
                                                                                lldb::endian::InlHostByteOrder(),
@@ -811,8 +808,7 @@ SBValue::CreateValueFromData (const char
         ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
         
         new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                       type.m_opaque_sp->GetASTContext() ,
-                                                       type.m_opaque_sp->GetOpaqueQualType(),
+                                                       type.m_opaque_sp->GetClangASTType(),
                                                        ConstString(name),
                                                        *data.m_opaque_sp,
                                                        LLDB_INVALID_ADDRESS);
@@ -1187,7 +1183,7 @@ SBValue::GetOpaqueType()
     ValueLocker locker;
     lldb::ValueObjectSP value_sp(GetSP(locker));
     if (value_sp)
-        return value_sp->GetClangType();
+        return value_sp->GetClangType().GetOpaqueQualType();
     return NULL;
 }
 
@@ -1665,7 +1661,7 @@ SBValue::Watch (bool resolve_location, b
             watch_type |= LLDB_WATCH_TYPE_WRITE;
         
         Error rc;
-        ClangASTType type (value_sp->GetClangAST(), value_sp->GetClangType());
+        ClangASTType type (value_sp->GetClangType());
         WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
         error.SetError(rc);
         

Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocationList.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocationList.cpp Wed Jul 17 17:17:41 2013
@@ -14,7 +14,9 @@
 // Project includes
 #include "lldb/Breakpoint/BreakpointLocationList.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -114,7 +116,24 @@ BreakpointLocationList::FindByAddress (c
     BreakpointLocationSP bp_loc_sp;
     if (!m_locations.empty())
     {
-        addr_map::const_iterator pos = m_address_to_location.find (addr);
+        Address so_addr;
+
+        if (addr.IsSectionOffset())
+        {
+            so_addr = addr;
+        }
+        else
+        {
+            // Try and resolve as a load address if possible.
+            m_owner.GetTarget().GetSectionLoadList().ResolveLoadAddress (addr.GetOffset(), so_addr);
+            if (!so_addr.IsValid())
+            {    
+                // The address didn't resolve, so just set to passed in addr.
+                so_addr = addr;
+            }
+        }
+
+        addr_map::const_iterator pos = m_address_to_location.find (so_addr);
         if (pos != m_address_to_location.end())
             bp_loc_sp = pos->second;
     }

Modified: lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp Wed Jul 17 17:17:41 2013
@@ -54,8 +54,7 @@ Watchpoint::Watchpoint (Target& target,
     {
         // If we don't have a known type, then we force it to unsigned int of the right size.
         ClangASTContext *ast_context = target.GetScratchClangASTContext();
-        clang_type_t clang_type = ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 8 * size);
-        m_type.SetClangType(ast_context->getASTContext(), clang_type);
+        m_type = ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 8 * size);
     }
     
     // Set the initial value of the watched variable:

Modified: lldb/branches/lldb-platform-work/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/CMakeLists.txt?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/CMakeLists.txt Wed Jul 17 17:17:41 2013
@@ -90,6 +90,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
     lldbHostLinux
     lldbPluginProcessLinux
     lldbPluginProcessPOSIX
+    lldbPluginProcessElfCore
     )
 endif ()
 
@@ -99,6 +100,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
     lldbHostFreeBSD
     lldbPluginProcessFreeBSD
     lldbPluginProcessPOSIX
+    lldbPluginProcessElfCore
     )
 endif ()
 

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp Wed Jul 17 17:17:41 2013
@@ -164,7 +164,7 @@ CommandObjectArgs::DoExecute (Args& args
         const char *arg_type_cstr = args.GetArgumentAtIndex(arg_index);
         Value value;
         value.SetValueType(Value::eValueTypeScalar);
-        void *type;
+        ClangASTType clang_type;
         
         char *int_pos;
         if ((int_pos = strstr (const_cast<char*>(arg_type_cstr), "int")))
@@ -207,9 +207,9 @@ CommandObjectArgs::DoExecute (Args& args
                 return false;
             }
             
-            type = ast_context.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
+            clang_type = ast_context.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
             
-            if (!type)
+            if (!clang_type.IsValid())
             {
                 result.AppendErrorWithFormat ("Couldn't get Clang type for format %s (%s integer, width %d).\n",
                                              arg_type_cstr,
@@ -223,9 +223,9 @@ CommandObjectArgs::DoExecute (Args& args
         else if (strchr (arg_type_cstr, '*'))
         {
             if (!strcmp (arg_type_cstr, "void*"))
-                type = ast_context.CreatePointerType (ast_context.GetBuiltInType_void ());
+                clang_type = ast_context.GetBasicType(eBasicTypeVoid).GetPointerType();
             else if (!strcmp (arg_type_cstr, "char*"))
-                type = ast_context.GetCStringType (false);
+                clang_type = ast_context.GetCStringType (false);
             else
             {
                 result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
@@ -240,8 +240,7 @@ CommandObjectArgs::DoExecute (Args& args
             return false;
         }
                      
-        value.SetContext (Value::eContextTypeClangType, type);
-        
+        value.SetClangType (clang_type);
         value_list.PushValue(value);
     }
     

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp Wed Jul 17 17:17:41 2013
@@ -333,6 +333,11 @@ protected:
                     if (!success)
                         error.SetErrorStringWithFormat("invalid value for stop-on-continue: %s", option_arg);
                     break;
+                case 's':
+                    m_silent_run = Args::StringToBoolean(option_arg, true, &success);
+                    if (!success)
+                        error.SetErrorStringWithFormat("invalid value for silent-run: %s", option_arg);
+                    break;
                 default:
                     error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
                     break;
@@ -345,6 +350,7 @@ protected:
         OptionParsingStarting ()
         {
             m_stop_on_error.Clear();
+            m_silent_run = false;
             m_stop_on_continue = true;
         }
 
@@ -361,6 +367,7 @@ protected:
         // Instance variables to hold the values for command options.
 
         OptionValueBoolean m_stop_on_error;
+	    bool m_silent_run;
         bool m_stop_on_continue;
     };
     
@@ -376,7 +383,7 @@ protected:
 
             FileSpec cmd_file (filename, true);
             ExecutionContext *exe_ctx = NULL;  // Just use the default context.
-            bool echo_commands    = true;
+            bool echo_commands    = !m_options.m_silent_run;
             bool print_results    = true;
             bool stop_on_error = m_options.m_stop_on_error.OptionWasSet() ? (bool)m_options.m_stop_on_error : m_interpreter.GetStopCmdSourceOnError();
 
@@ -405,6 +412,7 @@ CommandObjectCommandsSource::CommandOpti
 {
 { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, 0, eArgTypeBoolean,    "If true, stop executing commands on error."},
 { LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', required_argument, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on continue."},
+{ LLDB_OPT_SET_ALL, false, "silent-run", 's', required_argument, NULL, 0, eArgTypeBoolean, "If true don't echo commands while executing."},
 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
 };
 
@@ -1328,9 +1336,7 @@ protected:
             // Don't change the status if the command already set it...
             if (result.GetStatus() == eReturnStatusInvalid)
             {
-                if (result.GetErrorData() && result.GetErrorData()[0])
-                    result.SetStatus(eReturnStatusFailed);
-                else if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
+                if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
                     result.SetStatus(eReturnStatusSuccessFinishNoResult);
                 else
                     result.SetStatus(eReturnStatusSuccessFinishResult);

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp Wed Jul 17 17:17:41 2013
@@ -543,15 +543,15 @@ protected:
                 else
                 {
                     TypeSP type_sp (type_list.GetTypeAtIndex(0));
-                    clang_ast_type.SetClangType (type_sp->GetClangAST(), type_sp->GetClangFullType());
+                    clang_ast_type = type_sp->GetClangFullType();
                 }
             }
             
             while (pointer_count > 0)
             {
-                clang_type_t pointer_type = ClangASTContext::CreatePointerType (clang_ast_type.GetASTContext(), clang_ast_type.GetOpaqueQualType());
-                if (pointer_type)
-                    clang_ast_type.SetClangType (clang_ast_type.GetASTContext(), pointer_type);
+                ClangASTType pointer_type = clang_ast_type.GetPointerType();
+                if (pointer_type.IsValid())
+                    clang_ast_type = pointer_type;
                 else
                 {
                     result.AppendError ("unable make a pointer type\n");
@@ -561,7 +561,7 @@ protected:
                 --pointer_count;
             }
 
-            m_format_options.GetByteSizeValue() = clang_ast_type.GetClangTypeByteSize();
+            m_format_options.GetByteSizeValue() = clang_ast_type.GetByteSize();
             
             if (m_format_options.GetByteSizeValue() == 0)
             {
@@ -675,7 +675,7 @@ protected:
             if (m_format_options.GetFormatValue().OptionWasSet() == false)
                 m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
 
-            bytes_read = clang_ast_type.GetTypeByteSize() * m_format_options.GetCountValue().GetCurrentValue();
+            bytes_read = clang_ast_type.GetByteSize() * m_format_options.GetCountValue().GetCurrentValue();
         }
         else if (m_format_options.GetFormatValue().GetCurrentValue() != eFormatCString)
         {

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectSource.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectSource.cpp Wed Jul 17 17:17:41 2013
@@ -26,6 +26,7 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/TargetList.h"
 #include "lldb/Interpreter/CommandCompletions.h"
@@ -439,6 +440,73 @@ protected:
         return 0;
     }
 
+    // From Jim: The FindMatchingFunctions / FindMatchingFunctionSymbols functions 
+    // "take a possibly empty vector of strings which are names of modules, and
+    // run the two search functions on the subset of the full module list that
+    // matches the strings in the input vector". If we wanted to put these somewhere,
+    // there should probably be a module-filter-list that can be passed to the
+    // various ModuleList::Find* calls, which would either be a vector of string
+    // names or a ModuleSpecList.
+    size_t FindMatchingFunctions (Target *target, const ConstString &name, SymbolContextList& sc_list)
+    {
+        // Displaying the source for a symbol:
+        bool include_inlines = true;
+        bool append = true;
+        bool include_symbols = false;
+        size_t num_matches = 0;
+        
+        if (m_options.num_lines == 0)
+            m_options.num_lines = 10;
+
+        const size_t num_modules = m_options.modules.size();
+        if (num_modules > 0)
+        {
+            ModuleList matching_modules;
+            for (size_t i = 0; i < num_modules; ++i)
+            {
+                FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+                if (module_file_spec)
+                {
+                    ModuleSpec module_spec (module_file_spec);
+                    matching_modules.Clear();
+                    target->GetImages().FindModules (module_spec, matching_modules);
+                    num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
+                }
+            }
+        }
+        else
+        {
+            num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
+        }
+        return num_matches;
+    }
+
+    size_t FindMatchingFunctionSymbols (Target *target, const ConstString &name, SymbolContextList& sc_list)
+    {
+        size_t num_matches = 0;
+        const size_t num_modules = m_options.modules.size();
+        if (num_modules > 0)
+        {
+            ModuleList matching_modules;
+            for (size_t i = 0; i < num_modules; ++i)
+            {
+                FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+                if (module_file_spec)
+                {
+                    ModuleSpec module_spec (module_file_spec);
+                    matching_modules.Clear();
+                    target->GetImages().FindModules (module_spec, matching_modules);
+                    num_matches += matching_modules.FindFunctionSymbols (name, eFunctionNameTypeAuto, sc_list);
+                }
+            }
+        }
+        else
+        {
+            num_matches = target->GetImages().FindFunctionSymbols (name, eFunctionNameTypeAuto, sc_list);
+        }
+        return num_matches;
+    }
+
     bool
     DoExecute (Args& command, CommandReturnObject &result)
     {
@@ -453,41 +521,36 @@ protected:
 
         Target *target = m_exe_ctx.GetTargetPtr();
 
-        SymbolContextList sc_list;
         if (!m_options.symbol_name.empty())
         {
-            // Displaying the source for a symbol:
+            SymbolContextList sc_list;
             ConstString name(m_options.symbol_name.c_str());
-            bool include_symbols = false;
-            bool include_inlines = true;
-            bool append = true;
-            size_t num_matches = 0;
-            
-            if (m_options.num_lines == 0)
-                m_options.num_lines = 10;
 
-            const size_t num_modules = m_options.modules.size();
-            if (num_modules > 0)
-            {
-                ModuleList matching_modules;
-                for (size_t i = 0; i < num_modules; ++i)
-                {
-                    FileSpec module_file_spec(m_options.modules[i].c_str(), false);
-                    if (module_file_spec)
+            // Displaying the source for a symbol. Search for function named name.
+            size_t num_matches = FindMatchingFunctions (target, name, sc_list);
+            if (!num_matches)
+            {
+                // If we didn't find any functions with that name, try searching for symbols
+                // that line up exactly with function addresses.
+                SymbolContextList sc_list_symbols;
+                size_t num_symbol_matches = FindMatchingFunctionSymbols (target, name, sc_list_symbols);
+                for (size_t i = 0; i < num_symbol_matches; i++)
+                {
+                    SymbolContext sc;
+                    sc_list_symbols.GetContextAtIndex (i, sc);
+                    if (sc.symbol)
                     {
-                        ModuleSpec module_spec (module_file_spec);
-                        matching_modules.Clear();
-                        target->GetImages().FindModules (module_spec, matching_modules);
-                        num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
+                        const Address &base_address = sc.symbol->GetAddress();
+                        Function *function = base_address.CalculateSymbolContextFunction();
+                        if (function)
+                        {
+                            sc_list.Append (SymbolContext(function));
+                            num_matches++;
+                            break;
+                        }
                     }
                 }
             }
-            else
-            {
-                num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-            }
-            
-            SymbolContext sc;
 
             if (num_matches == 0)
             {
@@ -495,7 +558,7 @@ protected:
                 result.SetStatus (eReturnStatusFailed);
                 return false;
             }
-            
+
             if (num_matches > 1)
             {
                 std::set<SourceInfo> source_match_set;
@@ -503,6 +566,7 @@ protected:
                 bool displayed_something = false;
                 for (size_t i = 0; i < num_matches; i++)
                 {
+                    SymbolContext sc;
                     sc_list.GetContextAtIndex (i, sc);
                     SourceInfo source_info (sc.GetFunctionName(),
                                             sc.GetFunctionStartLineEntry());
@@ -525,6 +589,7 @@ protected:
             }
             else
             {
+                SymbolContext sc;
                 sc_list.GetContextAtIndex (0, sc);
                 SourceInfo source_info;
                 
@@ -541,9 +606,9 @@ protected:
         }
         else if (m_options.address != LLDB_INVALID_ADDRESS)
         {
-            SymbolContext sc;
             Address so_addr;
             StreamString error_strm;
+            SymbolContextList sc_list;
 
             if (target->GetSectionLoadList().IsEmpty())
             {
@@ -556,6 +621,7 @@ protected:
                     ModuleSP module_sp (module_list.GetModuleAtIndex(i));
                     if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr))
                     {
+                        SymbolContext sc;
                         sc.Clear(true);
                         if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry)
                             sc_list.Append(sc);
@@ -579,6 +645,7 @@ protected:
                     ModuleSP module_sp (so_addr.GetModule());
                     if (module_sp)
                     {
+                        SymbolContext sc;
                         sc.Clear(true);
                         if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry)
                         {
@@ -605,6 +672,7 @@ protected:
             uint32_t num_matches = sc_list.GetSize();
             for (uint32_t i=0; i<num_matches; ++i)
             {
+                SymbolContext sc;
                 sc_list.GetContextAtIndex(i, sc);
                 if (sc.comp_unit)
                 {
@@ -738,12 +806,12 @@ protected:
             
             if (num_matches > 1)
             {
-                SymbolContext sc;
                 bool got_multiple = false;
                 FileSpec *test_cu_spec = NULL;
 
                 for (unsigned i = 0; i < num_matches; i++)
                 {
+                    SymbolContext sc;
                     sc_list.GetContextAtIndex(i, sc);
                     if (sc.comp_unit)
                     {

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp Wed Jul 17 17:17:41 2013
@@ -160,6 +160,7 @@ public:
         m_core_file (LLDB_OPT_SET_1, false, "core", 'c', 0, eArgTypeFilename, "Fullpath to a core file to use for this target."),
         m_platform_path (LLDB_OPT_SET_1, false, "platform-path", 'P', 0, eArgTypePath, "Path to the remote file to use for this target."),
         m_symbol_file (LLDB_OPT_SET_1, false, "symfile", 's', 0, eArgTypeFilename, "Fullpath to a stand alone debug symbols file for when debug symbols are not in the executable."),
+        m_remote_file (LLDB_OPT_SET_1, false, "remote-file", 'r', 0, eArgTypeFilename, "Fullpath to the file on the remote host if debugging remotely."),
         m_add_dependents (LLDB_OPT_SET_1, false, "no-dependents", 'd', "Don't load dependent files when creating the target, just add the specified executable.", true, true)
     {
         CommandArgumentEntry arg;
@@ -180,6 +181,7 @@ public:
         m_option_group.Append (&m_core_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
         m_option_group.Append (&m_platform_path, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
         m_option_group.Append (&m_symbol_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+        m_option_group.Append (&m_remote_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
         m_option_group.Append (&m_add_dependents, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
         m_option_group.Finalize();
     }
@@ -224,7 +226,7 @@ protected:
     {
         const size_t argc = command.GetArgumentCount();
         FileSpec core_file (m_core_file.GetOptionValue().GetCurrentValue());
-        FileSpec remote_file (m_platform_path.GetOptionValue().GetCurrentValue());
+        FileSpec remote_file (m_remote_file.GetOptionValue().GetCurrentValue());
 
         if (argc == 1 || core_file || remote_file)
         {
@@ -315,11 +317,20 @@ protected:
 
             if (target_sp)
             {
-                if (symfile)
+                if (symfile || remote_file)
                 {
                     ModuleSP module_sp (target_sp->GetExecutableModule());
                     if (module_sp)
-                        module_sp->SetSymbolFileFileSpec(symfile);
+                    {
+                        if (symfile)
+                            module_sp->SetSymbolFileFileSpec(symfile);
+                        if (remote_file)
+                        {
+                            std::string remote_path = remote_file.GetPath();
+                            target_sp->SetArg0(remote_path.c_str());
+                            module_sp->SetPlatformFileSpec(remote_file);
+                        }
+                    }
                 }
                 
                 debugger.GetTargetList().SetSelectedTarget(target_sp.get());
@@ -400,6 +411,7 @@ private:
     OptionGroupFile m_core_file;
     OptionGroupFile m_platform_path;
     OptionGroupFile m_symbol_file;
+    OptionGroupFile m_remote_file;
     OptionGroupBoolean m_add_dependents;
 };
 
@@ -1523,7 +1535,7 @@ DumpModuleSections (CommandInterpreter &
 {
     if (module)
     {
-        SectionList *section_list = module->GetUnifiedSectionList();
+        SectionList *section_list = module->GetSectionList();
         if (section_list)
         {
             strm.Printf ("Sections for '%s' (%s):\n",
@@ -2874,7 +2886,7 @@ protected:
                         ObjectFile *objfile = module->GetObjectFile();
                         if (objfile)
                         {
-                            SectionList *section_list = objfile->GetSectionList();
+                            SectionList *section_list = module->GetSectionList();
                             if (section_list)
                             {
                                 bool changed = false;
@@ -4342,7 +4354,7 @@ protected:
             size_t num_matches = 0;
             // First extract all module specs from the symbol file
             lldb_private::ModuleSpecList symfile_module_specs;
-            if (ObjectFile::GetModuleSpecifications(module_spec.GetSymbolFileSpec(), 0, symfile_module_specs))
+            if (ObjectFile::GetModuleSpecifications(module_spec.GetSymbolFileSpec(), 0, 0, symfile_module_specs))
             {
                 // Now extract the module spec that matches the target architecture
                 ModuleSpec target_arch_module_spec;

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.cpp Wed Jul 17 17:17:41 2013
@@ -38,8 +38,16 @@ CommandObjectVersion::~CommandObjectVers
 bool
 CommandObjectVersion::DoExecute (Args& args, CommandReturnObject &result)
 {
-    result.AppendMessageWithFormat ("%s\n", lldb_private::GetVersion());
-    result.SetStatus (eReturnStatusSuccessFinishResult);
+    if (args.GetArgumentCount() == 0)
+    {
+        result.AppendMessageWithFormat ("%s\n", lldb_private::GetVersion());
+        result.SetStatus (eReturnStatusSuccessFinishResult);
+    }
+    else
+    {
+        result.AppendError("the version command takes no arguments.");
+        result.SetStatus (eReturnStatusFailed);
+    }
     return true;
 }
 

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.h (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectVersion.h Wed Jul 17 17:17:41 2013
@@ -34,7 +34,7 @@ public:
 protected:
     virtual bool
     DoExecute (Args& args,
-             CommandReturnObject &result);
+               CommandReturnObject &result);
 
 };
 

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp Wed Jul 17 17:17:41 2013
@@ -1050,7 +1050,7 @@ protected:
                 valobj_sp = valobj_list.GetValueObjectAtIndex(0);
         }
         
-        ClangASTType type;
+        ClangASTType clang_type;
         
         if (valobj_sp)
         {
@@ -1063,7 +1063,7 @@ protected:
                 size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize()
                                                            : m_option_watchpoint.watch_size;
             }
-            type.SetClangType(valobj_sp->GetClangAST(), valobj_sp->GetClangType());
+            clang_type = valobj_sp->GetClangType();
         }
         else
         {
@@ -1080,7 +1080,7 @@ protected:
         uint32_t watch_type = m_option_watchpoint.watch_type;
         
         error.Clear();
-        Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
+        Watchpoint *wp = target->CreateWatchpoint(addr, size, &clang_type, watch_type, error).get();
         if (wp)
         {
             wp->SetWatchSpec(command.GetArgumentAtIndex(0));
@@ -1292,12 +1292,10 @@ protected:
         
         // Fetch the type from the value object, the type of the watched object is the pointee type
         /// of the expression, so convert to that if we  found a valid type.
-        ClangASTType type(valobj_sp->GetClangAST(), valobj_sp->GetClangType());
-        if (type.IsValid())
-            type.SetClangType(type.GetASTContext(), type.GetPointeeType());
+        ClangASTType clang_type(valobj_sp->GetClangType());
         
         Error error;
-        Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
+        Watchpoint *wp = target->CreateWatchpoint(addr, size, &clang_type, watch_type, error).get();
         if (wp)
         {
             Stream &output_stream = result.GetOutputStream();

Modified: lldb/branches/lldb-platform-work/source/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/CMakeLists.txt?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/Core/CMakeLists.txt Wed Jul 17 17:17:41 2013
@@ -15,7 +15,6 @@ add_lldb_library(lldbCore
   ConnectionMachPort.cpp
   ConnectionSharedMemory.cpp
   ConstString.cpp
-  cxa_demangle.cpp  
   DataBufferHeap.cpp
   DataBufferMemoryMap.cpp
   DataEncoder.cpp
@@ -75,11 +74,3 @@ add_lldb_library(lldbCore
   #Windows.cpp
   )
 
-#FIXME: Below we append -frtti to cxa_demangle.cpp (and let the compiler choose to ignore the
-#       -fno-rtti that is added due to LLVM_NO_RTTI at the top of this file.) It would be
-#       better to replace -fno-rtti with -frtti rather than just appending the latter option.
-set_property(
-  SOURCE cxa_demangle.cpp
-  PROPERTY COMPILE_FLAGS -frtti
-  )
-

Modified: lldb/branches/lldb-platform-work/source/Core/DataBufferHeap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/DataBufferHeap.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/DataBufferHeap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/DataBufferHeap.cpp Wed Jul 17 17:17:41 2013
@@ -101,5 +101,9 @@ DataBufferHeap::CopyData (const void *sr
         m_data.clear();
 }
 
-
-
+void
+DataBufferHeap::Clear()
+{
+    buffer_t empty;
+    m_data.swap(empty);
+}

Modified: lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Debugger.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Debugger.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Debugger.cpp Wed Jul 17 17:17:41 2013
@@ -413,6 +413,7 @@ Debugger::LoadPlugin (const FileSpec& sp
     }
     lldb::DebuggerSP debugger_sp(shared_from_this());
     lldb::SBDebugger debugger_sb(debugger_sp);
+    // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger) function.
     // TODO: mangle this differently for your system - on OSX, the first underscore needs to be removed and the second one stays
     LLDBCommandPluginInit init_func = dynlib_sp->GetSymbol<LLDBCommandPluginInit>("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
     if (!init_func)
@@ -440,6 +441,7 @@ LoadPluginCallback
     Error error;
     
     static ConstString g_dylibext("dylib");
+    static ConstString g_solibext("so");
     
     if (!baton)
         return FileSpec::eEnumerateDirectoryResultQuit;
@@ -457,8 +459,11 @@ LoadPluginCallback
         FileSpec plugin_file_spec (file_spec);
         plugin_file_spec.ResolvePath ();
         
-        if (plugin_file_spec.GetFileNameExtension() != g_dylibext)
+        if (plugin_file_spec.GetFileNameExtension() != g_dylibext &&
+            plugin_file_spec.GetFileNameExtension() != g_solibext)
+        {
             return FileSpec::eEnumerateDirectoryResultNext;
+        }
 
         Error plugin_load_error;
         debugger->LoadPlugin (plugin_file_spec, plugin_load_error);
@@ -1632,9 +1637,10 @@ FormatPromptRecurse
                                 }
                                 
                                 // TODO use flags for these
-                                bool is_array = ClangASTContext::IsArrayType(target->GetClangType(), NULL, NULL, NULL);
-                                bool is_pointer = ClangASTContext::IsPointerType(target->GetClangType());
-                                bool is_aggregate = ClangASTContext::IsAggregateType(target->GetClangType());
+                                const uint32_t type_info_flags = target->GetClangType().GetTypeInfo(NULL);
+                                bool is_array = (type_info_flags & ClangASTType::eTypeIsArray) != 0;
+                                bool is_pointer = (type_info_flags & ClangASTType::eTypeIsPointer) != 0;
+                                bool is_aggregate = target->GetClangType().IsAggregateType();
                                 
                                 if ((is_array || is_pointer) && (!is_array_range) && val_obj_display == ValueObject::eValueObjectRepresentationStyleValue) // this should be wrong, but there are some exceptions
                                 {

Modified: lldb/branches/lldb-platform-work/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Disassembler.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Disassembler.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Disassembler.cpp Wed Jul 17 17:17:41 2013
@@ -402,6 +402,9 @@ Disassembler::PrintInstructions
     ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
     StackFrame *frame = exe_ctx.GetFramePtr();
 
+    TargetSP target_sp (exe_ctx.GetTargetSP());
+    SourceManager &source_manager = target_sp ? target_sp->GetSourceManager() : debugger.GetSourceManager();
+
     if (frame)
         pc_addr_ptr = &frame->GetFrameCodeAddress();
     const uint32_t scope = eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
@@ -438,12 +441,12 @@ Disassembler::PrintInstructions
                                 
                                 if (sc.comp_unit && sc.line_entry.IsValid())
                                 {
-                                    debugger.GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.line_entry.file,
-                                                                                                   sc.line_entry.line,
-                                                                                                   num_mixed_context_lines,
-                                                                                                   num_mixed_context_lines,
-                                                                                                   ((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" : ""),
-                                                                                                   &strm);
+                                    source_manager.DisplaySourceLinesWithLineNumbers (sc.line_entry.file,
+                                                                                      sc.line_entry.line,
+                                                                                      num_mixed_context_lines,
+                                                                                      num_mixed_context_lines,
+                                                                                      ((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" : ""),
+                                                                                      &strm);
                                 }
                             }
                         }

Modified: lldb/branches/lldb-platform-work/source/Core/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Makefile?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Makefile (original)
+++ lldb/branches/lldb-platform-work/source/Core/Makefile Wed Jul 17 17:17:41 2013
@@ -12,15 +12,3 @@ LIBRARYNAME := lldbCore
 BUILD_ARCHIVE = 1
 
 include $(LLDB_LEVEL)/Makefile
-
-# Enable RTTI on GCC builds because one source file in this directory
-# (cxa_demangle.cpp) uses dynamic_cast<> and GCC (at least 4.6 and 4.7)
-# complain if we try to compile it with -fno-rtti.
-$(info shell basename CXX is $(shell basename $(CXX)))
-ifeq (g++,$(shell basename $(CXX) | colrm 4))
-$(ObjDir)/cxa_demangle.o: Compile.CXX := $(filter-out -fno-rtti,$(Compile.CXX)) -frtti
-endif
-
-ifeq (Darwin,$(shell uname -s))
-$(ObjDir)/cxa_demangle.o: Compile.CXX := $(filter-out -fno-rtti,$(Compile.CXX)) -frtti
-endif

Modified: lldb/branches/lldb-platform-work/source/Core/Mangled.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Mangled.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Mangled.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Mangled.cpp Wed Jul 17 17:17:41 2013
@@ -8,17 +8,9 @@
 //===----------------------------------------------------------------------===//
 
 
-#if defined(__APPLE__)
-#define USE_BUILTIN_LIBCXXABI_DEMANGLER 1
-#endif
-
-#if defined(USE_BUILTIN_LIBCXXABI_DEMANGLER)
-#include "lldb/Core/cxa_demangle.h"
-#else
 // FreeBSD9-STABLE requires this to know about size_t in cxxabi.h
 #include <cstddef>
 #include <cxxabi.h>
-#endif
 
 
 #include "llvm/ADT/DenseMap.h"
@@ -207,11 +199,7 @@ Mangled::GetDemangledName () const
             {
                 // We didn't already mangle this name, demangle it and if all goes well
                 // add it to our map.
-#if defined(USE_BUILTIN_LIBCXXABI_DEMANGLER)
-                char *demangled_name = lldb_cxxabiv1::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);
-#else
                 char *demangled_name = abi::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);
-#endif
 
                 if (demangled_name)
                 {

Modified: lldb/branches/lldb-platform-work/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Module.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Module.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Module.cpp Wed Jul 17 17:17:41 2013
@@ -245,7 +245,7 @@ Module::~Module()
     // function calls back into this module object. The ordering is important
     // here because symbol files can require the module object file. So we tear
     // down the symbol file first, then the object file.
-    m_unified_sections_ap.reset();
+    m_sections_ap.reset();
     m_symfile_ap.reset();
     m_objfile_sp.reset();
 }
@@ -441,9 +441,9 @@ Module::ResolveFileAddress (lldb::addr_t
 {
     Mutex::Locker locker (m_mutex);
     Timer scoped_timer(__PRETTY_FUNCTION__, "Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")", vm_addr);
-    ObjectFile* ofile = GetObjectFile();
-    if (ofile)
-        return so_addr.ResolveAddressUsingFileSections(vm_addr, ofile->GetSectionList());
+    SectionList *section_list = GetSectionList();
+    if (section_list)
+        return so_addr.ResolveAddressUsingFileSections(vm_addr, section_list);
     return false;
 }
 
@@ -1097,31 +1097,26 @@ Module::GetObjectFile()
     Mutex::Locker locker (m_mutex);
     if (m_did_load_objfile == false)
     {
-        m_did_load_objfile = true;
         Timer scoped_timer(__PRETTY_FUNCTION__,
                            "Module::GetObjectFile () module = %s", GetFileSpec().GetFilename().AsCString(""));
         DataBufferSP data_sp;
         lldb::offset_t data_offset = 0;
-        m_objfile_sp = ObjectFile::FindPlugin (shared_from_this(),
-                                               &m_file, 
-                                               m_object_offset, 
-                                               m_file.GetByteSize(), 
-                                               data_sp,
-                                               data_offset);
-        if (m_objfile_sp)
-        {
-            // Once we get the object file, update our module with the object file's 
-            // architecture since it might differ in vendor/os if some parts were
-            // unknown.
-            m_objfile_sp->GetArchitecture (m_arch);
-
-            // Populate m_unified_sections_ap with sections from objfile.
-            SectionList *section_list = m_objfile_sp->GetSectionList();
-            if (section_list)
+        const lldb::offset_t file_size = m_file.GetByteSize();
+        if (file_size > m_object_offset)
+        {
+            m_did_load_objfile = true;
+            m_objfile_sp = ObjectFile::FindPlugin (shared_from_this(),
+                                                   &m_file,
+                                                   m_object_offset,
+                                                   file_size - m_object_offset,
+                                                   data_sp,
+                                                   data_offset);
+            if (m_objfile_sp)
             {
-                m_unified_sections_ap.reset(new SectionList());
-                section_list->Copy (m_unified_sections_ap.get());
-                m_unified_sections_ap->Finalize();
+                // Once we get the object file, update our module with the object file's 
+                // architecture since it might differ in vendor/os if some parts were
+                // unknown.
+                m_objfile_sp->GetArchitecture (m_arch);
             }
         }
     }
@@ -1129,9 +1124,25 @@ Module::GetObjectFile()
 }
 
 SectionList *
+Module::GetSectionList()
+{
+    // Populate m_unified_sections_ap with sections from objfile.
+    if (m_sections_ap.get() == NULL)
+    {
+        ObjectFile *obj_file = GetObjectFile();
+        if (obj_file)
+            obj_file->CreateSections(*GetUnifiedSectionList());
+    }
+    return m_sections_ap.get();
+}
+
+SectionList *
 Module::GetUnifiedSectionList()
 {
-    return m_unified_sections_ap.get();
+    // Populate m_unified_sections_ap with sections from objfile.
+    if (m_sections_ap.get() == NULL)
+        m_sections_ap.reset(new SectionList());
+    return m_sections_ap.get();
 }
 
 const Symbol *
@@ -1246,7 +1257,7 @@ Module::SetSymbolFileFileSpec (const Fil
     // Remove any sections in the unified section list that come from the current symbol vendor.
     if (m_symfile_ap)
     {
-        SectionList *section_list = GetUnifiedSectionList();
+        SectionList *section_list = GetSectionList();
         SymbolFile *symbol_file = m_symfile_ap->GetSymbolFile();
         if (section_list && symbol_file)
         {
@@ -1259,10 +1270,9 @@ Module::SetSymbolFileFileSpec (const Fil
                     lldb::SectionSP section_sp (section_list->GetSectionAtIndex (idx - 1));
                     if (section_sp->GetObjectFile() == obj_file)
                     {
-                        m_unified_sections_ap->DeleteSection (idx - 1);
+                        section_list->DeleteSection (idx - 1);
                     }
                 }
-                m_unified_sections_ap->Finalize();
             }
         }
     }
@@ -1287,7 +1297,7 @@ Module::IsLoadedInTarget (Target *target
     ObjectFile *obj_file = GetObjectFile();
     if (obj_file)
     {
-        SectionList *sections = obj_file->GetSectionList();
+        SectionList *sections = GetSectionList();
         if (sections != NULL)
         {
             size_t num_sections = sections->GetSize();
@@ -1394,26 +1404,22 @@ bool
 Module::SetLoadAddress (Target &target, lldb::addr_t offset, bool &changed)
 {
     size_t num_loaded_sections = 0;
-    ObjectFile *objfile = GetObjectFile();
-    if (objfile)
+    SectionList *section_list = GetSectionList ();
+    if (section_list)
     {
-        SectionList *section_list = objfile->GetSectionList ();
-        if (section_list)
-        {
-            const size_t num_sections = section_list->GetSize();
-            size_t sect_idx = 0;
-            for (sect_idx = 0; sect_idx < num_sections; ++sect_idx)
+        const size_t num_sections = section_list->GetSize();
+        size_t sect_idx = 0;
+        for (sect_idx = 0; sect_idx < num_sections; ++sect_idx)
+        {
+            // Iterate through the object file sections to find the
+            // first section that starts of file offset zero and that
+            // has bytes in the file...
+            SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
+            // Only load non-thread specific sections when given a slide
+            if (section_sp && !section_sp->IsThreadSpecific())
             {
-                // Iterate through the object file sections to find the
-                // first section that starts of file offset zero and that
-                // has bytes in the file...
-                SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
-                // Only load non-thread specific sections when given a slide
-                if (section_sp && !section_sp->IsThreadSpecific())
-                {
-                    if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, section_sp->GetFileAddress() + offset))
-                        ++num_loaded_sections;
-                }
+                if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, section_sp->GetFileAddress() + offset))
+                    ++num_loaded_sections;
             }
         }
     }

Modified: lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ModuleList.cpp Wed Jul 17 17:17:41 2013
@@ -386,7 +386,6 @@ ModuleList::FindFunctions (const ConstSt
     }
     else
     {
-    
         Mutex::Locker locker(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
@@ -397,6 +396,67 @@ ModuleList::FindFunctions (const ConstSt
     return sc_list.GetSize() - old_size;
 }
 
+size_t
+ModuleList::FindFunctionSymbols (const ConstString &name,
+                                 uint32_t name_type_mask,
+                                 SymbolContextList& sc_list)
+{
+    const size_t old_size = sc_list.GetSize();
+
+    if (name_type_mask & eFunctionNameTypeAuto)
+    {
+        ConstString lookup_name;
+        uint32_t lookup_name_type_mask = 0;
+        bool match_name_after_lookup = false;
+        Module::PrepareForFunctionNameLookup (name, name_type_mask,
+                                              lookup_name,
+                                              lookup_name_type_mask,
+                                              match_name_after_lookup);
+    
+        Mutex::Locker locker(m_modules_mutex);
+        collection::const_iterator pos, end = m_modules.end();
+        for (pos = m_modules.begin(); pos != end; ++pos)
+        {
+            (*pos)->FindFunctionSymbols (lookup_name,
+                                   lookup_name_type_mask,
+                                   sc_list);
+        }
+        
+        if (match_name_after_lookup)
+        {
+            SymbolContext sc;
+            size_t i = old_size;
+            while (i<sc_list.GetSize())
+            {
+                if (sc_list.GetContextAtIndex(i, sc))
+                {
+                    const char *func_name = sc.GetFunctionName().GetCString();
+                    if (func_name && strstr (func_name, name.GetCString()) == NULL)
+                    {
+                        // Remove the current context
+                        sc_list.RemoveContextAtIndex(i);
+                        // Don't increment i and continue in the loop
+                        continue;
+                    }
+                }
+                ++i;
+            }
+        }
+
+    }
+    else
+    {
+        Mutex::Locker locker(m_modules_mutex);
+        collection::const_iterator pos, end = m_modules.end();
+        for (pos = m_modules.begin(); pos != end; ++pos)
+        {
+            (*pos)->FindFunctionSymbols (name, name_type_mask, sc_list);
+        }
+    }
+
+    return sc_list.GetSize() - old_size;
+}
+
 size_t
 ModuleList::FindCompileUnits (const FileSpec &path, 
                               bool append, 

Modified: lldb/branches/lldb-platform-work/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/PluginManager.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/PluginManager.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/PluginManager.cpp Wed Jul 17 17:17:41 2013
@@ -75,7 +75,7 @@ SetPluginInfo (const FileSpec &plugin_fi
 {
     Mutex::Locker locker (GetPluginMapMutex ());
     PluginTerminateMap &plugin_map = GetPluginMap ();
-    assert (plugin_map.find (plugin_file_spec) != plugin_map.end());
+    assert (plugin_map.find (plugin_file_spec) == plugin_map.end());
     plugin_map[plugin_file_spec] = plugin_info;
 }
 
@@ -1388,15 +1388,17 @@ PluginManager::AutoCompletePlatformName
 struct ProcessInstance
 {
     ProcessInstance() :
-    name(),
-    description(),
-    create_callback(NULL)
+        name(),
+        description(),
+        create_callback(NULL),
+        debugger_init_callback(NULL)
     {
     }
     
     ConstString name;
     std::string description;
     ProcessCreateInstance create_callback;
+    DebuggerInitializeCallback debugger_init_callback;
 };
 
 typedef std::vector<ProcessInstance> ProcessInstances;
@@ -1417,12 +1419,10 @@ GetProcessInstances ()
 
 
 bool
-PluginManager::RegisterPlugin
-(
- const ConstString &name,
- const char *description,
- ProcessCreateInstance create_callback
- )
+PluginManager::RegisterPlugin (const ConstString &name,
+                               const char *description,
+                               ProcessCreateInstance create_callback,
+                               DebuggerInitializeCallback debugger_init_callback)
 {
     if (create_callback)
     {
@@ -1432,6 +1432,7 @@ PluginManager::RegisterPlugin
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
+        instance.debugger_init_callback = debugger_init_callback;
         Mutex::Locker locker (GetProcessMutex ());
         GetProcessInstances ().push_back (instance);
     }
@@ -1851,13 +1852,26 @@ PluginManager::DebuggerInitialize (Debug
                 pos->debugger_init_callback (debugger);
         }
     }
+    
+    // Initialize the Process plugins
+    {
+        Mutex::Locker locker (GetProcessMutex());
+        ProcessInstances &instances = GetProcessInstances();
+        
+        ProcessInstances::iterator pos, end = instances.end();
+        for (pos = instances.begin(); pos != end; ++ pos)
+        {
+            if (pos->debugger_init_callback)
+                pos->debugger_init_callback (debugger);
+        }
+    }
+
 }
 
-// This will put a plugin's settings under e.g. "plugin.dynamic-loader.darwin-kernel.SETTINGNAME".
-// The new preferred ordering is to put plugins under "dynamic-loader.plugin.darwin-kernel.SETTINGNAME"
-// and if there were a generic dynamic-loader setting, it would be "dynamic-loader.SETTINGNAME".
+// This is the preferred new way to register plugin specific settings.  e.g.
+// This will put a plugin's settings under e.g. "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
 static lldb::OptionValuePropertiesSP
-GetDebuggerPropertyForPluginsOldStyle (Debugger &debugger,
+GetDebuggerPropertyForPlugins (Debugger &debugger,
                                        const ConstString &plugin_type_name,
                                        const ConstString &plugin_type_desc,
                                        bool can_create)
@@ -1894,14 +1908,14 @@ GetDebuggerPropertyForPluginsOldStyle (D
     return lldb::OptionValuePropertiesSP();
 }
 
-// This is the preferred new way to register plugin specific settings.  e.g.
-// "platform.plugin.darwin-kernel.SETTINGNAME"
+// This is deprecated way to register plugin specific settings.  e.g.
+// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME"
 // and Platform generic settings would be under "platform.SETTINGNAME".
 static lldb::OptionValuePropertiesSP
-GetDebuggerPropertyForPlugins (Debugger &debugger, 
-                               const ConstString &plugin_type_name,
-                               const ConstString &plugin_type_desc,
-                               bool can_create)
+GetDebuggerPropertyForPluginsOldStyle (Debugger &debugger,
+                                       const ConstString &plugin_type_name,
+                                       const ConstString &plugin_type_desc,
+                                       bool can_create)
 {
     static ConstString g_property_name("plugin");
     lldb::OptionValuePropertiesSP parent_properties_sp (debugger.GetValueProperties());
@@ -1939,7 +1953,7 @@ lldb::OptionValuePropertiesSP
 PluginManager::GetSettingForDynamicLoaderPlugin (Debugger &debugger, const ConstString &setting_name)
 {
     lldb::OptionValuePropertiesSP properties_sp;
-    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
+    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
                                                                                             ConstString("dynamic-loader"),
                                                                                             ConstString(), // not creating to so we don't need the description
                                                                                             false));
@@ -1956,7 +1970,7 @@ PluginManager::CreateSettingForDynamicLo
 {
     if (properties_sp)
     {
-        lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
+        lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
                                                                                                 ConstString("dynamic-loader"),
                                                                                                 ConstString("Settings for dynamic loader plug-ins"),
                                                                                                 true));
@@ -1977,10 +1991,10 @@ lldb::OptionValuePropertiesSP
 PluginManager::GetSettingForPlatformPlugin (Debugger &debugger, const ConstString &setting_name)
 {
     lldb::OptionValuePropertiesSP properties_sp;
-    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
-                                                                                            ConstString("platform"),
-                                                                                            ConstString(), // not creating to so we don't need the description
-                                                                                            false));
+    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
+                                                                                                    ConstString("platform"),
+                                                                                                    ConstString(), // not creating to so we don't need the description
+                                                                                                    false));
     if (plugin_type_properties_sp)
         properties_sp = plugin_type_properties_sp->GetSubProperty (NULL, setting_name);
     return properties_sp;
@@ -1994,9 +2008,47 @@ PluginManager::CreateSettingForPlatformP
 {
     if (properties_sp)
     {
+        lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
+                                                                                                        ConstString("platform"),
+                                                                                                        ConstString("Settings for platform plug-ins"),
+                                                                                                        true));
+        if (plugin_type_properties_sp)
+        {
+            plugin_type_properties_sp->AppendProperty (properties_sp->GetName(),
+                                                       description,
+                                                       is_global_property,
+                                                       properties_sp);
+            return true;
+        }
+    }
+    return false;
+}
+
+
+lldb::OptionValuePropertiesSP
+PluginManager::GetSettingForProcessPlugin (Debugger &debugger, const ConstString &setting_name)
+{
+    lldb::OptionValuePropertiesSP properties_sp;
+    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
+                                                                                            ConstString("process"),
+                                                                                            ConstString(), // not creating to so we don't need the description
+                                                                                            false));
+    if (plugin_type_properties_sp)
+        properties_sp = plugin_type_properties_sp->GetSubProperty (NULL, setting_name);
+    return properties_sp;
+}
+
+bool
+PluginManager::CreateSettingForProcessPlugin (Debugger &debugger,
+                                              const lldb::OptionValuePropertiesSP &properties_sp,
+                                              const ConstString &description,
+                                              bool is_global_property)
+{
+    if (properties_sp)
+    {
         lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
-                                                                                                ConstString("platform"),
-                                                                                                ConstString("Settings for platform plug-ins"),
+                                                                                                ConstString("process"),
+                                                                                                ConstString("Settings for process plug-ins"),
                                                                                                 true));
         if (plugin_type_properties_sp)
         {

Modified: lldb/branches/lldb-platform-work/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Section.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Section.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Section.cpp Wed Jul 17 17:17:41 2013
@@ -292,8 +292,6 @@ Section::Slide (addr_t slide_amount, boo
 #pragma mark SectionList
 
 SectionList::SectionList () :
-    m_changed(false),
-    m_revision_id(0),
     m_sections()
 {
 }
@@ -303,22 +301,17 @@ SectionList::~SectionList ()
 {
 }
 
-bool
-SectionList::Copy (SectionList *dest_section_list)
+SectionList &
+SectionList::operator = (const SectionList& rhs)
 {
-    if (dest_section_list)
-    {
-        dest_section_list->m_sections = m_sections;
-        dest_section_list->m_changed = true;
-        return true;
-    }
-    return false;
+    if (this != &rhs)
+        m_sections = rhs.m_sections;
+    return *this;
 }
 
 size_t
 SectionList::AddSection (const lldb::SectionSP& section_sp)
 {
-    m_changed = true;
     assert (section_sp.get());
     size_t section_index = m_sections.size();
     m_sections.push_back(section_sp);
@@ -331,7 +324,6 @@ SectionList::DeleteSection (size_t idx)
 {
     if (idx < m_sections.size())
     {
-        m_changed = true;
         m_sections.erase (m_sections.begin() + idx);
         return true; 
     }
@@ -361,7 +353,6 @@ SectionList::AddUniqueSection (const lld
     size_t sect_idx = FindSectionIndex (sect_sp.get());
     if (sect_idx == UINT32_MAX)
     {
-        m_changed = true;
         sect_idx = AddSection (sect_sp);
     }
     return sect_idx;
@@ -375,7 +366,6 @@ SectionList::ReplaceSection (user_id_t s
     {
         if ((*sect_iter)->GetID() == sect_id)
         {
-            m_changed = true;
             *sect_iter = sect_sp;
             return true;
         }
@@ -552,22 +542,3 @@ SectionList::Slide (addr_t slide_amount,
     }
     return count;
 }
-
-void
-SectionList::Finalize ()
-{
-    for (const_iterator si = m_sections.begin(), se = m_sections.end();
-         si != se;
-         ++si)
-    {
-        Section *sect = si->get();
-        
-        sect->GetChildren().Finalize();
-    }
-
-    if (m_changed)
-    {
-        m_revision_id++;
-        m_changed = false;
-    }
-}

Modified: lldb/branches/lldb-platform-work/source/Core/UUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/UUID.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/UUID.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/UUID.cpp Wed Jul 17 17:17:41 2013
@@ -105,25 +105,34 @@ UUID::Dump (Stream *s) const
     }
 }
 
-void
+bool
 UUID::SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes)
 {
-    if (uuid_bytes && num_uuid_bytes >= 20)
+    if (uuid_bytes)
     {
-        m_num_uuid_bytes = 20;
-        ::memcpy (m_uuid, uuid_bytes, m_num_uuid_bytes);
-    }
-    else if (uuid_bytes && num_uuid_bytes >= 16)
-    {
-        m_num_uuid_bytes = 16;
-        ::memcpy (m_uuid, uuid_bytes, m_num_uuid_bytes);
-        m_uuid[16] = m_uuid[17] = m_uuid[18] = m_uuid[19] = 0;
-    }
-    else
-    {
-        m_num_uuid_bytes = 16;
-        ::memset (m_uuid, 0, sizeof(m_uuid));
+        switch (num_uuid_bytes)
+        {
+            case 20:
+                m_num_uuid_bytes = 20;
+                break;
+            case 16:
+                m_num_uuid_bytes = 16;
+                m_uuid[16] = m_uuid[17] = m_uuid[18] = m_uuid[19] = 0;
+                break;
+            default:
+                // Unsupported UUID byte size
+                m_num_uuid_bytes = 0;
+                break;
+        }
+
+        if (m_num_uuid_bytes > 0)
+        {
+            ::memcpy (m_uuid, uuid_bytes, m_num_uuid_bytes);
+            return true;
+        }
     }
+    ::memset (m_uuid, 0, sizeof(m_uuid));
+    return false;
 }
 
 size_t

Modified: lldb/branches/lldb-platform-work/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Value.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Value.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Value.cpp Wed Jul 17 17:17:41 2013
@@ -33,8 +33,10 @@ using namespace lldb_private;
 
 Value::Value() :
     m_value (),
-    m_value_type (eValueTypeScalar),
+    m_vector (),
+    m_clang_type (),
     m_context (NULL),
+    m_value_type (eValueTypeScalar),
     m_context_type (eContextTypeInvalid),
     m_data_buffer ()
 {
@@ -42,8 +44,10 @@ Value::Value() :
 
 Value::Value(const Scalar& scalar) :
     m_value (scalar),
-    m_value_type (eValueTypeScalar),
+    m_vector (),
+    m_clang_type (),
     m_context (NULL),
+    m_value_type (eValueTypeScalar),
     m_context_type (eContextTypeInvalid),
     m_data_buffer ()
 {
@@ -52,8 +56,10 @@ Value::Value(const Scalar& scalar) :
 
 Value::Value(const uint8_t *bytes, int len) :
     m_value (),
-    m_value_type (eValueTypeHostAddress),
+    m_vector (),
+    m_clang_type (),
     m_context (NULL),
+    m_value_type (eValueTypeHostAddress),
     m_context_type (eContextTypeInvalid),
     m_data_buffer ()
 {
@@ -62,10 +68,13 @@ Value::Value(const uint8_t *bytes, int l
 }
 
 Value::Value(const Value &v) :
-    m_value(v.m_value),
-    m_value_type(v.m_value_type),
-    m_context(v.m_context),
-    m_context_type(v.m_context_type)
+    m_value (v.m_value),
+    m_vector (v.m_vector),
+    m_clang_type (v.m_clang_type),
+    m_context (v.m_context),
+    m_value_type (v.m_value_type),
+    m_context_type (v.m_context_type),
+    m_data_buffer ()
 {
     if ((uintptr_t)v.m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)v.m_data_buffer.GetBytes())
     {
@@ -82,8 +91,10 @@ Value::operator=(const Value &rhs)
     if (this != &rhs)
     {
         m_value = rhs.m_value;
-        m_value_type = rhs.m_value_type;
+        m_vector = rhs.m_vector;
+        m_clang_type = rhs.m_clang_type;
         m_context = rhs.m_context;
+        m_value_type = rhs.m_value_type;
         m_context_type = rhs.m_context_type;
         if ((uintptr_t)rhs.m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)rhs.m_data_buffer.GetBytes())
         {
@@ -152,72 +163,42 @@ Value::ResizeData(size_t len)
 }
 
 bool
-Value::ValueOf(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
+Value::ValueOf(ExecutionContext *exe_ctx)
 {
     switch (m_context_type)
     {
     case eContextTypeInvalid:
-    case eContextTypeClangType:         // clang::Type *
     case eContextTypeRegisterInfo:      // RegisterInfo *
     case eContextTypeLLDBType:          // Type *
         break;
 
     case eContextTypeVariable:          // Variable *
-        ResolveValue(exe_ctx, ast_context);
+        ResolveValue(exe_ctx);
         return true;
     }
     return false;
 }
 
 uint64_t
-Value::GetValueByteSize (clang::ASTContext *ast_context, Error *error_ptr)
+Value::GetValueByteSize (Error *error_ptr)
 {
     uint64_t byte_size = 0;
 
     switch (m_context_type)
     {
-    case eContextTypeInvalid:
-        // If we have no context, there is no way to know how much memory to read
-        if (error_ptr)
-            error_ptr->SetErrorString ("Invalid context type, there is no way to know how much memory to read.");
-        break;
-
-    case eContextTypeClangType:
-        if (ast_context == NULL)
-        {
-            if (error_ptr)
-                error_ptr->SetErrorString ("Can't determine size of opaque clang type with NULL ASTContext *.");
-        }
-        else
-        {
-            byte_size = ClangASTType(ast_context, m_context).GetClangTypeByteSize();
-        }
-        break;
-
     case eContextTypeRegisterInfo:     // RegisterInfo *
         if (GetRegisterInfo())
             byte_size = GetRegisterInfo()->byte_size;
-        else if (error_ptr)
-            error_ptr->SetErrorString ("Can't determine byte size with NULL RegisterInfo *.");
-        break;
-
-    case eContextTypeLLDBType:             // Type *
-        if (GetType())
-            byte_size = GetType()->GetByteSize();
-        else if (error_ptr)
-            error_ptr->SetErrorString ("Can't determine byte size with NULL Type *.");
         break;
 
+    case eContextTypeInvalid:
+    case eContextTypeLLDBType:         // Type *
     case eContextTypeVariable:         // Variable *
-        if (GetVariable())
-        {   
-            if (GetVariable()->GetType())
-                byte_size = GetVariable()->GetType()->GetByteSize();
-            else if (error_ptr)
-                error_ptr->SetErrorString ("Can't determine byte size with NULL Type *.");
+        {
+            const ClangASTType &ast_type = GetClangType();
+            if (ast_type.IsValid())
+                byte_size = ast_type.GetByteSize();
         }
-        else if (error_ptr)
-            error_ptr->SetErrorString ("Can't determine byte size with NULL Variable *.");
         break;
     }
 
@@ -236,32 +217,48 @@ Value::GetValueByteSize (clang::ASTConte
     return byte_size;
 }
 
-clang_type_t
+const ClangASTType &
 Value::GetClangType ()
 {
-    switch (m_context_type)
+    if (!m_clang_type.IsValid())
     {
-    case eContextTypeInvalid:
-        break;
-
-    case eContextTypeClangType:
-        return m_context;
+        switch (m_context_type)
+        {
+        case eContextTypeInvalid:
+            break;
 
-    case eContextTypeRegisterInfo:
-        break;    // TODO: Eventually convert into a clang type?
+        case eContextTypeRegisterInfo:
+            break;    // TODO: Eventually convert into a clang type?
 
-    case eContextTypeLLDBType:
-        if (GetType())
-            return GetType()->GetClangForwardType();
-        break;
+        case eContextTypeLLDBType:
+            {
+                Type *lldb_type = GetType();
+                if (lldb_type)
+                    m_clang_type = lldb_type->GetClangForwardType();
+            }
+            break;
 
-    case eContextTypeVariable:
-        if (GetVariable())
-            return GetVariable()->GetType()->GetClangForwardType();
-        break;
+        case eContextTypeVariable:
+            {
+                Variable *variable = GetVariable();
+                if (variable)
+                {
+                    Type *variable_type = variable->GetType();
+                    if (variable_type)
+                        m_clang_type = variable_type->GetClangForwardType();
+                }
+            }
+            break;
+        }
     }
 
-    return NULL;
+    return m_clang_type;
+}
+
+void
+Value::SetClangType (const ClangASTType &clang_type)
+{
+    m_clang_type = clang_type;
 }
 
 lldb::Format
@@ -269,25 +266,19 @@ Value::GetValueDefaultFormat ()
 {
     switch (m_context_type)
     {
-    case eContextTypeInvalid:
-        break;
-
-    case eContextTypeClangType:
-        return ClangASTType::GetFormat (m_context);
-
     case eContextTypeRegisterInfo:
         if (GetRegisterInfo())
             return GetRegisterInfo()->format;
         break;
 
+    case eContextTypeInvalid:
     case eContextTypeLLDBType:
-        if (GetType())
-            return GetType()->GetFormat();
-        break;
-
     case eContextTypeVariable:
-        if (GetVariable())
-            return GetVariable()->GetType()->GetFormat();
+        {
+            const ClangASTType &ast_type = GetClangType();
+            if (ast_type.IsValid())
+                return ast_type.GetFormat();
+        }
         break;
 
     }
@@ -326,8 +317,7 @@ Value::GetData (DataExtractor &data)
 
 Error
 Value::GetValueAsData (ExecutionContext *exe_ctx,
-                       clang::ASTContext *ast_context, 
-                       DataExtractor &data, 
+                       DataExtractor &data,
                        uint32_t data_offset,
                        Module *module)
 {
@@ -337,15 +327,12 @@ Value::GetValueAsData (ExecutionContext
     lldb::addr_t address = LLDB_INVALID_ADDRESS;
     AddressType address_type = eAddressTypeFile;
     Address file_so_addr;
+    const ClangASTType &ast_type = GetClangType();
     switch (m_value_type)
     {
     case eValueTypeVector:
-        if (m_context_type == eContextTypeClangType && ast_context)
-        {
-            ClangASTType ptr_type (ast_context, ClangASTContext::GetVoidPtrType(ast_context, false));
-            uint64_t ptr_byte_size = ptr_type.GetClangTypeByteSize();
-            data.SetAddressByteSize (ptr_byte_size);
-        }
+        if (ast_type.IsValid())
+            data.SetAddressByteSize (ast_type.GetPointerByteSize());
         else
             data.SetAddressByteSize(sizeof(void *));
         data.SetData(m_vector.bytes, m_vector.length, m_vector.byte_order);
@@ -353,12 +340,8 @@ Value::GetValueAsData (ExecutionContext
 
     case eValueTypeScalar:
         data.SetByteOrder (lldb::endian::InlHostByteOrder());
-        if (m_context_type == eContextTypeClangType && ast_context)
-        {
-            ClangASTType ptr_type (ast_context, ClangASTContext::GetVoidPtrType(ast_context, false));
-            uint64_t ptr_byte_size = ptr_type.GetClangTypeByteSize();
-            data.SetAddressByteSize (ptr_byte_size);
-        }
+        if (ast_type.IsValid())
+            data.SetAddressByteSize (ast_type.GetPointerByteSize());
         else
             data.SetAddressByteSize(sizeof(void *));
         if (m_value.GetData (data))
@@ -562,7 +545,7 @@ Value::GetValueAsData (ExecutionContext
     }
 
     // If we got here, we need to read the value from memory
-    size_t byte_size = GetValueByteSize (ast_context, &error);
+    size_t byte_size = GetValueByteSize (&error);
 
     // Bail if we encountered any errors getting the byte size
     if (error.Fail())
@@ -637,10 +620,10 @@ Value::GetValueAsData (ExecutionContext
 }
 
 Scalar &
-Value::ResolveValue(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
-{    
-    void *opaque_clang_qual_type = GetClangType();
-    if (opaque_clang_qual_type)
+Value::ResolveValue(ExecutionContext *exe_ctx)
+{
+    const ClangASTType &clang_type = GetClangType();
+    if (clang_type.IsValid())
     {
         switch (m_value_type)
         {
@@ -654,11 +637,11 @@ Value::ResolveValue(ExecutionContext *ex
             {
                 DataExtractor data;
                 lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS);
-                Error error (GetValueAsData (exe_ctx, ast_context, data, 0, NULL));
+                Error error (GetValueAsData (exe_ctx, data, 0, NULL));
                 if (error.Success())
                 {
                     Scalar scalar;
-                    if (ClangASTType::GetValueAsScalar (ast_context, opaque_clang_qual_type, data, 0, data.GetByteSize(), scalar))
+                    if (clang_type.GetValueAsScalar (data, 0, data.GetByteSize(), scalar))
                     {
                         m_value = scalar;
                         m_value_type = eValueTypeScalar;
@@ -695,6 +678,19 @@ Value::GetVariable()
     return NULL;
 }
 
+void
+Value::Clear()
+{
+    m_value.Clear();
+    m_vector.Clear();
+    m_clang_type.Clear();
+    m_value_type = eValueTypeScalar;
+    m_context = NULL;
+    m_context_type = eContextTypeInvalid;
+    m_data_buffer.Clear();
+}
+
+
 const char *
 Value::GetValueTypeAsCString (ValueType value_type)
 {    
@@ -715,7 +711,6 @@ Value::GetContextTypeAsCString (ContextT
     switch (context_type)
     {
     case eContextTypeInvalid:       return "invalid";
-    case eContextTypeClangType:     return "clang::Type *";
     case eContextTypeRegisterInfo:  return "RegisterInfo *";
     case eContextTypeLLDBType:      return "Type *";
     case eContextTypeVariable:      return "Variable *";
@@ -763,3 +758,4 @@ ValueList::Clear ()
 {
     m_values.clear();
 }
+

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp Wed Jul 17 17:17:41 2013
@@ -283,101 +283,80 @@ ValueObject::ClearDynamicTypeInformation
 ClangASTType
 ValueObject::MaybeCalculateCompleteType ()
 {
-    ClangASTType ret(GetClangASTImpl(), GetClangTypeImpl());
+    ClangASTType clang_type(GetClangTypeImpl());
         
     if (m_did_calculate_complete_objc_class_type)
     {
         if (m_override_type.IsValid())
             return m_override_type;
         else
-            return ret;
+            return clang_type;
     }
     
-    clang_type_t ast_type(GetClangTypeImpl());
-    clang_type_t class_type;
-    bool is_pointer_type;
+    ClangASTType class_type;
+    bool is_pointer_type = false;
     
-    if (ClangASTContext::IsObjCObjectPointerType(ast_type, &class_type))
+    if (clang_type.IsObjCObjectPointerType(&class_type))
     {
         is_pointer_type = true;
     }
-    else if (ClangASTContext::IsObjCClassType(ast_type))
+    else if (clang_type.IsObjCObjectOrInterfaceType())
     {
-        is_pointer_type = false;
-        class_type = ast_type;
+        class_type = clang_type;
     }
     else
     {
-        return ret;
+        return clang_type;
     }
     
     m_did_calculate_complete_objc_class_type = true;
     
-    if (!class_type)
-        return ret;
-    
-    std::string class_name;
-    
-    if (!ClangASTContext::GetObjCClassName(class_type, class_name))
-        return ret;
-    
-    ProcessSP process_sp(GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-    
-    if (!process_sp)
-        return ret;
-    
-    ObjCLanguageRuntime *objc_language_runtime(process_sp->GetObjCLanguageRuntime());
-    
-    if (!objc_language_runtime)
-        return ret;
-    
-    ConstString class_name_cs(class_name.c_str());
-    
-    TypeSP complete_objc_class_type_sp = objc_language_runtime->LookupInCompleteClassCache(class_name_cs);
-    
-    if (!complete_objc_class_type_sp)
-        return ret;
-    
-    ClangASTType complete_class(complete_objc_class_type_sp->GetClangAST(),
-                                complete_objc_class_type_sp->GetClangFullType());
-    
-    if (!ClangASTContext::GetCompleteType(complete_class.GetASTContext(), 
-                                          complete_class.GetOpaqueQualType()))
-        return ret;
-    
-    if (is_pointer_type)
+    if (class_type)
     {
-        clang_type_t pointer_type = ClangASTContext::CreatePointerType(complete_class.GetASTContext(),
-                                                                       complete_class.GetOpaqueQualType());
+        ConstString class_name (class_type.GetConstTypeName());
         
-        m_override_type = ClangASTType(complete_class.GetASTContext(),
-                                       pointer_type);
-    }
-    else
-    {
-        m_override_type = complete_class;
+        if (class_name)
+        {
+            ProcessSP process_sp(GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
+            
+            if (process_sp)
+            {
+                ObjCLanguageRuntime *objc_language_runtime(process_sp->GetObjCLanguageRuntime());
+                
+                if (objc_language_runtime)
+                {
+                    TypeSP complete_objc_class_type_sp = objc_language_runtime->LookupInCompleteClassCache(class_name);
+                    
+                    if (complete_objc_class_type_sp)
+                    {
+                        ClangASTType complete_class(complete_objc_class_type_sp->GetClangFullType());
+                        
+                        if (complete_class.GetCompleteType())
+                        {
+                            if (is_pointer_type)
+                            {
+                                m_override_type = complete_class.GetPointerType();
+                            }
+                            else
+                            {
+                                m_override_type = complete_class;
+                            }
+                            
+                            if (m_override_type.IsValid())
+                                return m_override_type;
+                        }
+                    }
+                }
+            }
+        }
     }
-    
-    if (m_override_type.IsValid())
-        return m_override_type;
-    else
-        return ret;
-}
-
-clang::ASTContext *
-ValueObject::GetClangAST ()
-{
-    ClangASTType type = MaybeCalculateCompleteType();
-    
-    return type.GetASTContext();
+    return clang_type;
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObject::GetClangType ()
 {
-    ClangASTType type = MaybeCalculateCompleteType();
-    
-    return type.GetOpaqueQualType();
+    return MaybeCalculateCompleteType();
 }
 
 DataExtractor &
@@ -474,7 +453,7 @@ ValueObject::ResolveValue (Scalar &scala
     {
         ExecutionContext exe_ctx (GetExecutionContextRef());
         Value tmp_value(m_value);
-        scalar = tmp_value.ResolveValue(&exe_ctx, GetClangAST ());
+        scalar = tmp_value.ResolveValue(&exe_ctx);
         if (scalar.IsValid())
         {
             const uint32_t bitfield_bit_size = GetBitfieldBitSize();
@@ -620,10 +599,7 @@ size_t
 ValueObject::GetIndexOfChildWithName (const ConstString &name)
 {
     bool omit_empty_base_classes = true;
-    return ClangASTContext::GetIndexOfChildWithName (GetClangAST(),
-                                                     GetClangType(),
-                                                     name.GetCString(),
-                                                     omit_empty_base_classes);
+    return GetClangType().GetIndexOfChildWithName (name.GetCString(), omit_empty_base_classes);
 }
 
 ValueObjectSP
@@ -639,14 +615,10 @@ ValueObject::GetChildMemberWithName (con
         UpdateValueIfNeeded(false);
 
     std::vector<uint32_t> child_indexes;
-    clang::ASTContext *clang_ast = GetClangAST();
-    void *clang_type = GetClangType();
     bool omit_empty_base_classes = true;
-    const size_t num_child_indexes =  ClangASTContext::GetIndexOfChildMemberWithName (clang_ast,
-                                                                                      clang_type,
-                                                                                      name.GetCString(),
-                                                                                      omit_empty_base_classes,
-                                                                                      child_indexes);
+    const size_t num_child_indexes =  GetClangType().GetIndexOfChildMemberWithName (name.GetCString(),
+                                                                                    omit_empty_base_classes,
+                                                                                    child_indexes);
     if (num_child_indexes > 0)
     {
         std::vector<uint32_t>::const_iterator pos = child_indexes.begin ();
@@ -689,9 +661,9 @@ ValueObject::MightHaveChildren()
     const uint32_t type_info = GetTypeInfo();
     if (type_info)
     {
-        if (type_info & (ClangASTContext::eTypeHasChildren |
-                         ClangASTContext::eTypeIsPointer |
-                         ClangASTContext::eTypeIsReference))
+        if (type_info & (ClangASTType::eTypeHasChildren |
+                         ClangASTType::eTypeIsPointer |
+                         ClangASTType::eTypeIsReference))
             has_children = true;
     }
     else
@@ -731,27 +703,23 @@ ValueObject::CreateChildAtIndex (size_t
     bool child_is_deref_of_parent = false;
 
     const bool transparent_pointers = synthetic_array_member == false;
-    clang::ASTContext *clang_ast = GetClangAST();
-    clang_type_t clang_type = GetClangType();
-    clang_type_t child_clang_type;
+    ClangASTType child_clang_type;
     
     ExecutionContext exe_ctx (GetExecutionContextRef());
     
-    child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (&exe_ctx,
-                                                                  clang_ast,
-                                                                  GetName().GetCString(),
-                                                                  clang_type,
-                                                                  idx,
-                                                                  transparent_pointers,
-                                                                  omit_empty_base_classes,
-                                                                  ignore_array_bounds,
-                                                                  child_name_str,
-                                                                  child_byte_size,
-                                                                  child_byte_offset,
-                                                                  child_bitfield_bit_size,
-                                                                  child_bitfield_bit_offset,
-                                                                  child_is_base_class,
-                                                                  child_is_deref_of_parent);
+    child_clang_type = GetClangType().GetChildClangTypeAtIndex (&exe_ctx,
+                                                                GetName().GetCString(),
+                                                                idx,
+                                                                transparent_pointers,
+                                                                omit_empty_base_classes,
+                                                                ignore_array_bounds,
+                                                                child_name_str,
+                                                                child_byte_size,
+                                                                child_byte_offset,
+                                                                child_bitfield_bit_size,
+                                                                child_bitfield_bit_offset,
+                                                                child_is_base_class,
+                                                                child_is_deref_of_parent);
     if (child_clang_type)
     {
         if (synthetic_index)
@@ -762,7 +730,6 @@ ValueObject::CreateChildAtIndex (size_t
             child_name.SetCString (child_name_str.c_str());
 
         valobj = new ValueObjectChild (*this,
-                                       clang_ast,
                                        child_clang_type,
                                        child_name,
                                        child_byte_size,
@@ -809,19 +776,14 @@ ValueObject::GetSummaryAsCString (TypeSu
         }
         else
         {
-            clang_type_t clang_type = GetClangType();
+            ClangASTType clang_type = GetClangType();
             
             // Do some default printout for function pointers
             if (clang_type)
             {
-                StreamString sstr;
-                clang_type_t elem_or_pointee_clang_type;
-                const Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, 
-                                                                      GetClangAST(), 
-                                                                      &elem_or_pointee_clang_type));
-                
-                if (ClangASTContext::IsFunctionPointerType (clang_type))
+                if (clang_type.IsFunctionPointerType ())
                 {
+                    StreamString sstr;
                     AddressType func_ptr_address_type = eAddressTypeInvalid;
                     addr_t func_ptr_address = GetPointerValue (&func_ptr_address_type);
                     if (func_ptr_address != 0 && func_ptr_address != LLDB_INVALID_ADDRESS)
@@ -885,15 +847,15 @@ ValueObject::GetSummaryAsCString ()
 bool
 ValueObject::IsCStringContainer(bool check_pointer)
 {
-    clang_type_t elem_or_pointee_clang_type;
-    const Flags type_flags (GetTypeInfo (&elem_or_pointee_clang_type));
-    bool is_char_arr_ptr (type_flags.AnySet (ClangASTContext::eTypeIsArray | ClangASTContext::eTypeIsPointer) &&
-                          ClangASTContext::IsCharType (elem_or_pointee_clang_type));
+    ClangASTType pointee_or_element_clang_type;
+    const Flags type_flags (GetTypeInfo (&pointee_or_element_clang_type));
+    bool is_char_arr_ptr (type_flags.AnySet (ClangASTType::eTypeIsArray | ClangASTType::eTypeIsPointer) &&
+                          pointee_or_element_clang_type.IsCharType ());
     if (!is_char_arr_ptr)
         return false;
     if (!check_pointer)
         return true;
-    if (type_flags.Test(ClangASTContext::eTypeIsArray))
+    if (type_flags.Test(ClangASTType::eTypeIsArray))
         return true;
     addr_t cstr_address = LLDB_INVALID_ADDRESS;
     AddressType cstr_address_type = eAddressTypeInvalid;
@@ -906,23 +868,18 @@ ValueObject::GetPointeeData (DataExtract
                              uint32_t item_idx,
                              uint32_t item_count)
 {
-    clang_type_t pointee_or_element_clang_type;
+    ClangASTType pointee_or_element_clang_type;
     const uint32_t type_info = GetTypeInfo (&pointee_or_element_clang_type);
-    const bool is_pointer_type = type_info & ClangASTContext::eTypeIsPointer;
-    const bool is_array_type = type_info & ClangASTContext::eTypeIsArray;
+    const bool is_pointer_type = type_info & ClangASTType::eTypeIsPointer;
+    const bool is_array_type = type_info & ClangASTType::eTypeIsArray;
     if (!(is_pointer_type || is_array_type))
         return 0;
     
     if (item_count == 0)
         return 0;
     
-    clang::ASTContext *ast = GetClangAST();
-    ClangASTType pointee_or_element_type(ast, pointee_or_element_clang_type);
-    
-    const uint64_t item_type_size = pointee_or_element_type.GetClangTypeByteSize();
-    
+    const uint64_t item_type_size = pointee_or_element_clang_type.GetByteSize();
     const uint64_t bytes = item_count * item_type_size;
-    
     const uint64_t offset = item_idx * item_type_size;
     
     if (item_idx == 0 && item_count == 1) // simply a deref
@@ -996,8 +953,7 @@ ValueObject::GetPointeeData (DataExtract
                 break;
             case eAddressTypeHost:
                 {
-                    ClangASTType valobj_type(ast, GetClangType());
-                    uint64_t max_bytes = valobj_type.GetClangTypeByteSize();
+                    const uint64_t max_bytes = GetClangType().GetByteSize();
                     if (max_bytes > offset)
                     {
                         size_t bytes_read = std::min<uint64_t>(max_bytes - offset, bytes);
@@ -1019,7 +975,7 @@ ValueObject::GetData (DataExtractor& dat
 {
     UpdateValueIfNeeded(false);
     ExecutionContext exe_ctx (GetExecutionContextRef());
-    Error error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), data, 0, GetModule().get());
+    Error error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
     if (error.Fail())
     {
         if (m_data.GetByteSize())
@@ -1050,7 +1006,7 @@ ValueObject::SetData (DataExtractor &dat
     }
     
     uint64_t count = 0;
-    Encoding encoding = ClangASTType::GetEncoding (GetClangType(), count);
+    const Encoding encoding = GetClangType().GetEncoding(count);
     
     const size_t byte_size = GetByteSize();
     
@@ -1163,25 +1119,29 @@ ValueObject::ReadPointedString (Stream&
     size_t bytes_read = 0;
     size_t total_bytes_read = 0;
     
-    clang_type_t clang_type = GetClangType();
-    clang_type_t elem_or_pointee_clang_type;
+    ClangASTType clang_type = GetClangType();
+    ClangASTType elem_or_pointee_clang_type;
     const Flags type_flags (GetTypeInfo (&elem_or_pointee_clang_type));
-    if (type_flags.AnySet (ClangASTContext::eTypeIsArray | ClangASTContext::eTypeIsPointer) &&
-        ClangASTContext::IsCharType (elem_or_pointee_clang_type))
+    if (type_flags.AnySet (ClangASTType::eTypeIsArray | ClangASTType::eTypeIsPointer) &&
+        elem_or_pointee_clang_type.IsCharType ())
     {
         addr_t cstr_address = LLDB_INVALID_ADDRESS;
         AddressType cstr_address_type = eAddressTypeInvalid;
         
         size_t cstr_len = 0;
         bool capped_data = false;
-        if (type_flags.Test (ClangASTContext::eTypeIsArray))
+        if (type_flags.Test (ClangASTType::eTypeIsArray))
         {
             // We have an array
-            cstr_len = ClangASTContext::GetArraySize (clang_type);
-            if (cstr_len > max_length)
+            uint64_t array_size = 0;
+            if (clang_type.IsArrayType(NULL, &array_size, NULL))
             {
-                capped_data = true;
-                cstr_len = max_length;
+                cstr_len = array_size;
+                if (cstr_len > max_length)
+                {
+                    capped_data = true;
+                    cstr_len = max_length;
+                }
             }
             cstr_address = GetAddressOf (true, &cstr_address_type);
         }
@@ -1318,12 +1278,11 @@ ValueObject::GetObjectDescription ()
     if (runtime == NULL)
     {
         // Aw, hell, if the things a pointer, or even just an integer, let's try ObjC anyway...
-        clang_type_t opaque_qual_type = GetClangType();
-        if (opaque_qual_type != NULL)
+        ClangASTType clang_type = GetClangType();
+        if (clang_type)
         {
             bool is_signed;
-            if (ClangASTContext::IsIntegerType (opaque_qual_type, is_signed) 
-                || ClangASTContext::IsPointerType (opaque_qual_type))
+            if (clang_type.IsIntegerType (is_signed) || clang_type.IsPointerType ())
             {
                 runtime = process->GetLanguageRuntime(eLanguageTypeObjC);
             }
@@ -1345,94 +1304,79 @@ bool
 ValueObject::GetValueAsCString (lldb::Format format,
                                 std::string& destination)
 {
-    if (ClangASTContext::IsAggregateType (GetClangType()) == false &&
-        UpdateValueIfNeeded(false))
+    if (GetClangType().IsAggregateType () == false && UpdateValueIfNeeded(false))
     {
         const Value::ContextType context_type = m_value.GetContextType();
         
-        switch (context_type)
+        if (context_type == Value::eContextTypeRegisterInfo)
         {
-            case Value::eContextTypeClangType:
-            case Value::eContextTypeLLDBType:
-            case Value::eContextTypeVariable:
+            const RegisterInfo *reg_info = m_value.GetRegisterInfo();
+            if (reg_info)
             {
-                clang_type_t clang_type = GetClangType ();
-                if (clang_type)
-                {
-                     // put custom bytes to display in this DataExtractor to override the default value logic
-                    lldb_private::DataExtractor special_format_data;
-                    clang::ASTContext* ast = GetClangAST();
-                    if (format == eFormatCString)
-                    {
-                        Flags type_flags(ClangASTContext::GetTypeInfo(clang_type, ast, NULL));
-                        if (type_flags.Test(ClangASTContext::eTypeIsPointer) && !type_flags.Test(ClangASTContext::eTypeIsObjC))
-                        {
-                            // if we are dumping a pointer as a c-string, get the pointee data as a string
-                            TargetSP target_sp(GetTargetSP());
-                            if (target_sp)
-                            {
-                                size_t max_len = target_sp->GetMaximumSizeOfStringSummary();
-                                Error error;
-                                DataBufferSP buffer_sp(new DataBufferHeap(max_len+1,0));
-                                Address address(GetPointerValue());
-                                if (target_sp->ReadCStringFromMemory(address, (char*)buffer_sp->GetBytes(), max_len, error) && error.Success())
-                                    special_format_data.SetData(buffer_sp);
-                            }
+                ExecutionContext exe_ctx (GetExecutionContextRef());
+                
+                StreamString reg_sstr;
+                m_data.Dump (&reg_sstr,
+                             0,
+                             format,
+                             reg_info->byte_size,
+                             1,
+                             UINT32_MAX,
+                             LLDB_INVALID_ADDRESS,
+                             0,
+                             0,
+                             exe_ctx.GetBestExecutionContextScope());
+                destination.swap(reg_sstr.GetString());
+            }
+        }
+        else
+        {
+            ClangASTType clang_type = GetClangType ();
+            if (clang_type)
+            {
+                 // put custom bytes to display in this DataExtractor to override the default value logic
+                lldb_private::DataExtractor special_format_data;
+                if (format == eFormatCString)
+                {
+                    Flags type_flags(clang_type.GetTypeInfo(NULL));
+                    if (type_flags.Test(ClangASTType::eTypeIsPointer) && !type_flags.Test(ClangASTType::eTypeIsObjC))
+                    {
+                        // if we are dumping a pointer as a c-string, get the pointee data as a string
+                        TargetSP target_sp(GetTargetSP());
+                        if (target_sp)
+                        {
+                            size_t max_len = target_sp->GetMaximumSizeOfStringSummary();
+                            Error error;
+                            DataBufferSP buffer_sp(new DataBufferHeap(max_len+1,0));
+                            Address address(GetPointerValue());
+                            if (target_sp->ReadCStringFromMemory(address, (char*)buffer_sp->GetBytes(), max_len, error) && error.Success())
+                                special_format_data.SetData(buffer_sp);
                         }
                     }
-                    
-                    StreamString sstr;
-                    ExecutionContext exe_ctx (GetExecutionContextRef());
-                    ClangASTType::DumpTypeValue (ast,                           // The clang AST
-                                                 clang_type,                    // The clang type to display
-                                                 &sstr,                         // The stream to use for display
-                                                 format,                        // Format to display this type with
-                                                 special_format_data.GetByteSize() ?
-                                                 special_format_data: m_data,   // Data to extract from
-                                                 0,                             // Byte offset into "m_data"
-                                                 GetByteSize(),                 // Byte size of item in "m_data"
-                                                 GetBitfieldBitSize(),          // Bitfield bit size
-                                                 GetBitfieldBitOffset(),        // Bitfield bit offset
-                                                 exe_ctx.GetBestExecutionContextScope()); 
-                    // Don't set the m_error to anything here otherwise
-                    // we won't be able to re-format as anything else. The
-                    // code for ClangASTType::DumpTypeValue() should always
-                    // return something, even if that something contains
-                    // an error messsage. "m_error" is used to detect errors
-                    // when reading the valid object, not for formatting errors.
-                    if (sstr.GetString().empty())
-                        destination.clear();
-                    else
-                        destination.swap(sstr.GetString());
                 }
-            }
-                break;
                 
-            case Value::eContextTypeRegisterInfo:
-            {
-                const RegisterInfo *reg_info = m_value.GetRegisterInfo();
-                if (reg_info)
-                {
-                    ExecutionContext exe_ctx (GetExecutionContextRef());
-                    
-                    StreamString reg_sstr;
-                    m_data.Dump (&reg_sstr, 
-                                 0, 
-                                 format, 
-                                 reg_info->byte_size, 
-                                 1, 
-                                 UINT32_MAX, 
-                                 LLDB_INVALID_ADDRESS, 
-                                 0, 
-                                 0, 
-                                 exe_ctx.GetBestExecutionContextScope());
-                    destination.swap(reg_sstr.GetString());
-                }
+                StreamString sstr;
+                ExecutionContext exe_ctx (GetExecutionContextRef());
+                clang_type.DumpTypeValue (&sstr,                         // The stream to use for display
+                                          format,                        // Format to display this type with
+                                          special_format_data.GetByteSize() ?
+                                          special_format_data: m_data,   // Data to extract from
+                                          0,                             // Byte offset into "m_data"
+                                          GetByteSize(),                 // Byte size of item in "m_data"
+                                          GetBitfieldBitSize(),          // Bitfield bit size
+                                          GetBitfieldBitOffset(),        // Bitfield bit offset
+                                          exe_ctx.GetBestExecutionContextScope());
+                // Don't set the m_error to anything here otherwise
+                // we won't be able to re-format as anything else. The
+                // code for ClangASTType::DumpTypeValue() should always
+                // return something, even if that something contains
+                // an error messsage. "m_error" is used to detect errors
+                // when reading the valid object, not for formatting errors.
+                if (sstr.GetString().empty())
+                    destination.clear();
+                else
+                    destination.swap(sstr.GetString());
             }
-                break;
-                
-            default:
-                break;
         }
         return !destination.empty();
     }
@@ -1464,8 +1408,7 @@ ValueObject::GetValueAsCString ()
                     }
                     else
                     {
-                        clang_type_t clang_type = GetClangType ();
-                        my_format = ClangASTType::GetFormat(clang_type);
+                        my_format = GetClangType().GetFormat();
                     }
                 }
             }
@@ -1495,7 +1438,7 @@ uint64_t
 ValueObject::GetValueAsUnsigned (uint64_t fail_value, bool *success)
 {
     // If our byte size is zero this is an aggregate type that has children
-    if (ClangASTContext::IsAggregateType (GetClangType()) == false)
+    if (!GetClangType().IsAggregateType())
     {
         Scalar scalar;
         if (ResolveValue (scalar))
@@ -1519,10 +1462,8 @@ bool
 ValueObject::HasSpecialPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display,
                                                Format custom_format)
 {
-    clang_type_t elem_or_pointee_type;
-    Flags flags(GetTypeInfo(&elem_or_pointee_type));
-    
-    if (flags.AnySet(ClangASTContext::eTypeIsArray | ClangASTContext::eTypeIsPointer)
+    Flags flags(GetTypeInfo());
+    if (flags.AnySet(ClangASTType::eTypeIsArray | ClangASTType::eTypeIsPointer)
         && val_obj_display == ValueObject::eValueObjectRepresentationStyleValue)
     {        
         if (IsCStringContainer(true) && 
@@ -1532,7 +1473,7 @@ ValueObject::HasSpecialPrintableRepresen
              custom_format == eFormatVectorOfChar))
             return true;
 
-        if (flags.Test(ClangASTContext::eTypeIsArray))
+        if (flags.Test(ClangASTType::eTypeIsArray))
         {
             if ((custom_format == eFormatBytes) ||
                 (custom_format == eFormatBytesWithASCII))
@@ -1563,15 +1504,14 @@ ValueObject::DumpPrintableRepresentation
                                          PrintableRepresentationSpecialCases special)
 {
 
-    clang_type_t elem_or_pointee_type;
-    Flags flags(GetTypeInfo(&elem_or_pointee_type));
+    Flags flags(GetTypeInfo());
     
     bool allow_special = ((special & ePrintableRepresentationSpecialCasesAllow) == ePrintableRepresentationSpecialCasesAllow);
     bool only_special = ((special & ePrintableRepresentationSpecialCasesOnly) == ePrintableRepresentationSpecialCasesOnly);
     
     if (allow_special)
     {
-        if (flags.AnySet(ClangASTContext::eTypeIsArray | ClangASTContext::eTypeIsPointer)
+        if (flags.AnySet(ClangASTType::eTypeIsArray | ClangASTType::eTypeIsPointer)
              && val_obj_display == ValueObject::eValueObjectRepresentationStyleValue)
         {
             // when being asked to get a printable display an array or pointer type directly, 
@@ -1597,7 +1537,7 @@ ValueObject::DumpPrintableRepresentation
             
             // this only works for arrays, because I have no way to know when
             // the pointed memory ends, and no special \0 end of data marker
-            if (flags.Test(ClangASTContext::eTypeIsArray))
+            if (flags.Test(ClangASTType::eTypeIsArray))
             {
                 if ((custom_format == eFormatBytes) ||
                     (custom_format == eFormatBytesWithASCII))
@@ -1745,7 +1685,7 @@ ValueObject::DumpPrintableRepresentation
                 cstr = GetSummaryAsCString();
             else if (val_obj_display == eValueObjectRepresentationStyleSummary)
             {
-                if (ClangASTContext::IsAggregateType (GetClangType()) == true)
+                if (GetClangType().IsAggregateType())
                 {
                     strm.Printf("%s @ %s", GetTypeName().AsCString(), GetLocationAsCString());
                     cstr = strm.GetString().c_str();
@@ -1862,7 +1802,7 @@ ValueObject::SetValueFromCString (const
     }
 
     uint64_t count = 0;
-    Encoding encoding = ClangASTType::GetEncoding (GetClangType(), count);
+    const Encoding encoding = GetClangType().GetEncoding (count);
 
     const size_t byte_size = GetByteSize();
 
@@ -1960,21 +1900,20 @@ ValueObject::GetDeclaration (Declaration
 ConstString
 ValueObject::GetTypeName()
 {
-    return ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
+    return GetClangType().GetConstTypeName();
 }
 
 ConstString
 ValueObject::GetQualifiedTypeName()
 {
-    return ClangASTType::GetConstQualifiedTypeName (GetClangAST(), GetClangType());
+    return GetClangType().GetConstQualifiedTypeName();
 }
 
 
 LanguageType
 ValueObject::GetObjectRuntimeLanguage ()
 {
-    return ClangASTType::GetMinimumLanguage (GetClangAST(),
-                                             GetClangType());
+    return GetClangType().GetMinimumLanguage ();
 }
 
 void
@@ -1994,39 +1933,39 @@ ValueObject::GetSyntheticChild (const Co
 }
 
 uint32_t
-ValueObject::GetTypeInfo (clang_type_t *pointee_or_element_clang_type)
+ValueObject::GetTypeInfo (ClangASTType *pointee_or_element_clang_type)
 {
-    return ClangASTContext::GetTypeInfo (GetClangType(), GetClangAST(), pointee_or_element_clang_type);
+    return GetClangType().GetTypeInfo (pointee_or_element_clang_type);
 }
 
 bool
 ValueObject::IsPointerType ()
 {
-    return ClangASTContext::IsPointerType (GetClangType());
+    return GetClangType().IsPointerType();
 }
 
 bool
 ValueObject::IsArrayType ()
 {
-    return ClangASTContext::IsArrayType (GetClangType(), NULL, NULL, NULL);
+    return GetClangType().IsArrayType (NULL, NULL, NULL);
 }
 
 bool
 ValueObject::IsScalarType ()
 {
-    return ClangASTContext::IsScalarType (GetClangType());
+    return GetClangType().IsScalarType ();
 }
 
 bool
 ValueObject::IsIntegerType (bool &is_signed)
 {
-    return ClangASTContext::IsIntegerType (GetClangType(), is_signed);
+    return GetClangType().IsIntegerType (is_signed);
 }
 
 bool
 ValueObject::IsPointerOrReferenceType ()
 {
-    return ClangASTContext::IsPointerOrReferenceType (GetClangType());
+    return GetClangType().IsPointerOrReferenceType ();
 }
 
 bool
@@ -2037,14 +1976,14 @@ ValueObject::IsPossibleDynamicType ()
     if (process)
         return process->IsPossibleDynamicValue(*this);
     else
-        return ClangASTContext::IsPossibleDynamicType (GetClangAST (), GetClangType(), NULL, true, true);
+        return GetClangType().IsPossibleDynamicType (NULL, true, true);
 }
 
 bool
 ValueObject::IsObjCNil ()
 {
-    const uint32_t mask = ClangASTContext::eTypeIsObjC | ClangASTContext::eTypeIsPointer;
-    bool isObjCpointer = ( ((ClangASTContext::GetTypeInfo(GetClangType(), GetClangAST(), NULL)) & mask) == mask);
+    const uint32_t mask = ClangASTType::eTypeIsObjC | ClangASTType::eTypeIsPointer;
+    bool isObjCpointer = (((GetClangType().GetTypeInfo(NULL)) & mask) == mask);
     if (!isObjCpointer)
         return false;
     bool canReadValue = true;
@@ -2056,10 +1995,10 @@ ValueObjectSP
 ValueObject::GetSyntheticArrayMember (size_t index, bool can_create)
 {
     const uint32_t type_info = GetTypeInfo ();
-    if (type_info & ClangASTContext::eTypeIsArray)
+    if (type_info & ClangASTType::eTypeIsArray)
         return GetSyntheticArrayMemberFromArray(index, can_create);
 
-    if (type_info & ClangASTContext::eTypeIsPointer)
+    if (type_info & ClangASTType::eTypeIsPointer)
         return GetSyntheticArrayMemberFromPointer(index, can_create);
     
     return ValueObjectSP();
@@ -2155,20 +2094,18 @@ ValueObject::GetSyntheticBitFieldChild (
         synthetic_child_sp = GetSyntheticChild (index_const_str);
         if (!synthetic_child_sp)
         {
-            ValueObjectChild *synthetic_child;
             // We haven't made a synthetic array member for INDEX yet, so
             // lets make one and cache it for any future reference.
-            synthetic_child = new ValueObjectChild(*this,
-                                                      GetClangAST(),
-                                                      GetClangType(),
-                                                      index_const_str,
-                                                      GetByteSize(),
-                                                      0,
-                                                      to-from+1,
-                                                      from,
-                                                      false,
-                                                      false,
-                                                      eAddressTypeInvalid);
+            ValueObjectChild *synthetic_child = new ValueObjectChild (*this,
+                                                                      GetClangType(),
+                                                                      index_const_str,
+                                                                      GetByteSize(),
+                                                                      0,
+                                                                      to-from+1,
+                                                                      from,
+                                                                      false,
+                                                                      false,
+                                                                      eAddressTypeInvalid);
             
             // Cache the value if we got one back...
             if (synthetic_child)
@@ -2204,10 +2141,9 @@ ValueObject::GetSyntheticChildAtOffset(u
         return ValueObjectSP();
     
     ValueObjectChild *synthetic_child = new ValueObjectChild(*this,
-                                                             type.GetASTContext(),
-                                                             type.GetOpaqueQualType(),
+                                                             type,
                                                              name_const_str,
-                                                             type.GetTypeByteSize(),
+                                                             type.GetByteSize(),
                                                              offset,
                                                              0,
                                                              0,
@@ -2377,9 +2313,9 @@ ValueObject::GetBaseClassPath (Stream &s
     if (IsBaseClass())
     {
         bool parent_had_base_class = GetParent() && GetParent()->GetBaseClassPath (s);
-        clang_type_t clang_type = GetClangType();
+        ClangASTType clang_type = GetClangType();
         std::string cxx_class_name;
-        bool this_had_base_class = ClangASTContext::GetCXXClassName (clang_type, cxx_class_name);
+        bool this_had_base_class = clang_type.GetCXXClassName (cxx_class_name);
         if (this_had_base_class)
         {
             if (parent_had_base_class)
@@ -2436,23 +2372,23 @@ ValueObject::GetExpressionPath (Stream &
             ValueObject *non_base_class_parent = GetNonBaseClassParent();
             if (non_base_class_parent)
             {
-                clang_type_t non_base_class_parent_clang_type = non_base_class_parent->GetClangType();
+                ClangASTType non_base_class_parent_clang_type = non_base_class_parent->GetClangType();
                 if (non_base_class_parent_clang_type)
                 {
-                    const uint32_t non_base_class_parent_type_info = ClangASTContext::GetTypeInfo (non_base_class_parent_clang_type, NULL, NULL);
-                    
                     if (parent && parent->IsDereferenceOfParent() && epformat == eGetExpressionPathFormatHonorPointers)
                     {
                         s.PutCString("->");
                     }
                     else
                     {                    
-                        if (non_base_class_parent_type_info & ClangASTContext::eTypeIsPointer)
+                        const uint32_t non_base_class_parent_type_info = non_base_class_parent_clang_type.GetTypeInfo();
+                        
+                        if (non_base_class_parent_type_info & ClangASTType::eTypeIsPointer)
                         {
                             s.PutCString("->");
                         }
-                        else if ((non_base_class_parent_type_info & ClangASTContext::eTypeHasChildren) &&
-                                 !(non_base_class_parent_type_info & ClangASTContext::eTypeIsArray))
+                        else if ((non_base_class_parent_type_info & ClangASTType::eTypeHasChildren) &&
+                                 !(non_base_class_parent_type_info & ClangASTType::eTypeIsArray))
                         {
                             s.PutChar('.');
                         }
@@ -2657,13 +2593,13 @@ ValueObject::GetValueForExpressionPath_I
         
         const char* expression_cstr = *first_unparsed; // hide the top level expression_cstr
         
-        clang_type_t root_clang_type = root->GetClangType();
-        clang_type_t pointee_clang_type;
-        Flags root_clang_type_info,pointee_clang_type_info;
+        ClangASTType root_clang_type = root->GetClangType();
+        ClangASTType pointee_clang_type;
+        Flags pointee_clang_type_info;
         
-        root_clang_type_info = Flags(ClangASTContext::GetTypeInfo(root_clang_type, GetClangAST(), &pointee_clang_type));
+        Flags root_clang_type_info(root_clang_type.GetTypeInfo(&pointee_clang_type));
         if (pointee_clang_type)
-            pointee_clang_type_info = Flags(ClangASTContext::GetTypeInfo(pointee_clang_type, GetClangAST(), NULL));
+            pointee_clang_type_info.Reset(pointee_clang_type.GetTypeInfo());
         
         if (!expression_cstr || *expression_cstr == '\0')
         {
@@ -2676,15 +2612,15 @@ ValueObject::GetValueForExpressionPath_I
             case '-':
             {
                 if (options.m_check_dot_vs_arrow_syntax &&
-                    root_clang_type_info.Test(ClangASTContext::eTypeIsPointer) ) // if you are trying to use -> on a non-pointer and I must catch the error
+                    root_clang_type_info.Test(ClangASTType::eTypeIsPointer) ) // if you are trying to use -> on a non-pointer and I must catch the error
                 {
                     *first_unparsed = expression_cstr;
                     *reason_to_stop = ValueObject::eExpressionPathScanEndReasonArrowInsteadOfDot;
                     *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
                     return ValueObjectSP();
                 }
-                if (root_clang_type_info.Test(ClangASTContext::eTypeIsObjC) &&  // if yo are trying to extract an ObjC IVar when this is forbidden
-                    root_clang_type_info.Test(ClangASTContext::eTypeIsPointer) &&
+                if (root_clang_type_info.Test(ClangASTType::eTypeIsObjC) &&  // if yo are trying to extract an ObjC IVar when this is forbidden
+                    root_clang_type_info.Test(ClangASTType::eTypeIsPointer) &&
                     options.m_no_fragile_ivar)
                 {
                     *first_unparsed = expression_cstr;
@@ -2704,7 +2640,7 @@ ValueObject::GetValueForExpressionPath_I
             case '.': // or fallthrough from ->
             {
                 if (options.m_check_dot_vs_arrow_syntax && *expression_cstr == '.' &&
-                    root_clang_type_info.Test(ClangASTContext::eTypeIsPointer)) // if you are trying to use . on a pointer and I must catch the error
+                    root_clang_type_info.Test(ClangASTType::eTypeIsPointer)) // if you are trying to use . on a pointer and I must catch the error
                 {
                     *first_unparsed = expression_cstr;
                     *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDotInsteadOfArrow;
@@ -2805,9 +2741,9 @@ ValueObject::GetValueForExpressionPath_I
             }
             case '[':
             {
-                if (!root_clang_type_info.Test(ClangASTContext::eTypeIsArray) && !root_clang_type_info.Test(ClangASTContext::eTypeIsPointer) && !root_clang_type_info.Test(ClangASTContext::eTypeIsVector)) // if this is not a T[] nor a T*
+                if (!root_clang_type_info.Test(ClangASTType::eTypeIsArray) && !root_clang_type_info.Test(ClangASTType::eTypeIsPointer) && !root_clang_type_info.Test(ClangASTType::eTypeIsVector)) // if this is not a T[] nor a T*
                 {
-                    if (!root_clang_type_info.Test(ClangASTContext::eTypeIsScalar)) // if this is not even a scalar...
+                    if (!root_clang_type_info.Test(ClangASTType::eTypeIsScalar)) // if this is not even a scalar...
                     {
                         if (options.m_no_synthetic_children) // ...only chance left is synthetic
                         {
@@ -2827,7 +2763,7 @@ ValueObject::GetValueForExpressionPath_I
                 }
                 if (*(expression_cstr+1) == ']') // if this is an unbounded range it only works for arrays
                 {
-                    if (!root_clang_type_info.Test(ClangASTContext::eTypeIsArray))
+                    if (!root_clang_type_info.Test(ClangASTType::eTypeIsArray))
                     {
                         *first_unparsed = expression_cstr;
                         *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
@@ -2864,7 +2800,7 @@ ValueObject::GetValueForExpressionPath_I
                     }
                     if (end - expression_cstr == 1) // if this is [], only return a valid value for arrays
                     {
-                        if (root_clang_type_info.Test(ClangASTContext::eTypeIsArray))
+                        if (root_clang_type_info.Test(ClangASTType::eTypeIsArray))
                         {
                             *first_unparsed = expression_cstr+2;
                             *reason_to_stop = ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
@@ -2880,7 +2816,7 @@ ValueObject::GetValueForExpressionPath_I
                         }
                     }
                     // from here on we do have a valid index
-                    if (root_clang_type_info.Test(ClangASTContext::eTypeIsArray))
+                    if (root_clang_type_info.Test(ClangASTType::eTypeIsArray))
                     {
                         ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index, true);
                         if (!child_valobj_sp)
@@ -2903,10 +2839,10 @@ ValueObject::GetValueForExpressionPath_I
                             return ValueObjectSP();
                         }
                     }
-                    else if (root_clang_type_info.Test(ClangASTContext::eTypeIsPointer))
+                    else if (root_clang_type_info.Test(ClangASTType::eTypeIsPointer))
                     {
                         if (*what_next == ValueObject::eExpressionPathAftermathDereference &&  // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
-                            pointee_clang_type_info.Test(ClangASTContext::eTypeIsScalar))
+                            pointee_clang_type_info.Test(ClangASTType::eTypeIsScalar))
                         {
                             Error error;
                             root = root->Dereference(error);
@@ -2925,9 +2861,8 @@ ValueObject::GetValueForExpressionPath_I
                         }
                         else
                         {
-                            if (ClangASTType::GetMinimumLanguage(root->GetClangAST(),
-                                                                 root->GetClangType()) == eLanguageTypeObjC
-                                && pointee_clang_type_info.AllClear(ClangASTContext::eTypeIsPointer)
+                            if (root->GetClangType().GetMinimumLanguage() == eLanguageTypeObjC
+                                && pointee_clang_type_info.AllClear(ClangASTType::eTypeIsPointer)
                                 && root->HasSyntheticValue()
                                 && options.m_no_synthetic_children == false)
                             {
@@ -2950,7 +2885,7 @@ ValueObject::GetValueForExpressionPath_I
                             }
                         }
                     }
-                    else if (root_clang_type_info.Test(ClangASTContext::eTypeIsScalar))
+                    else if (root_clang_type_info.Test(ClangASTType::eTypeIsScalar))
                     {
                         root = root->GetSyntheticBitFieldChild(index, index, true);
                         if (!root.get())
@@ -2968,7 +2903,7 @@ ValueObject::GetValueForExpressionPath_I
                             return root;
                         }
                     }
-                    else if (root_clang_type_info.Test(ClangASTContext::eTypeIsVector))
+                    else if (root_clang_type_info.Test(ClangASTType::eTypeIsVector))
                     {
                         root = root->GetChildAtIndex(index, true);
                         if (!root.get())
@@ -3053,7 +2988,7 @@ ValueObject::GetValueForExpressionPath_I
                         index_lower = index_higher;
                         index_higher = temp;
                     }
-                    if (root_clang_type_info.Test(ClangASTContext::eTypeIsScalar)) // expansion only works for scalars
+                    if (root_clang_type_info.Test(ClangASTType::eTypeIsScalar)) // expansion only works for scalars
                     {
                         root = root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
                         if (!root.get())
@@ -3071,9 +3006,9 @@ ValueObject::GetValueForExpressionPath_I
                             return root;
                         }
                     }
-                    else if (root_clang_type_info.Test(ClangASTContext::eTypeIsPointer) && // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
+                    else if (root_clang_type_info.Test(ClangASTType::eTypeIsPointer) && // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
                              *what_next == ValueObject::eExpressionPathAftermathDereference &&
-                             pointee_clang_type_info.Test(ClangASTContext::eTypeIsScalar))
+                             pointee_clang_type_info.Test(ClangASTType::eTypeIsScalar))
                     {
                         Error error;
                         root = root->Dereference(error);
@@ -3132,13 +3067,12 @@ ValueObject::ExpandArraySliceExpression(
         
         const char* expression_cstr = *first_unparsed; // hide the top level expression_cstr
         
-        clang_type_t root_clang_type = root->GetClangType();
-        clang_type_t pointee_clang_type;
-        Flags root_clang_type_info,pointee_clang_type_info;
-        
-        root_clang_type_info = Flags(ClangASTContext::GetTypeInfo(root_clang_type, GetClangAST(), &pointee_clang_type));
+        ClangASTType root_clang_type = root->GetClangType();
+        ClangASTType pointee_clang_type;
+        Flags pointee_clang_type_info;
+        Flags root_clang_type_info(root_clang_type.GetTypeInfo(&pointee_clang_type));
         if (pointee_clang_type)
-            pointee_clang_type_info = Flags(ClangASTContext::GetTypeInfo(pointee_clang_type, GetClangAST(), NULL));
+            pointee_clang_type_info.Reset(pointee_clang_type.GetTypeInfo());
         
         if (!expression_cstr || *expression_cstr == '\0')
         {
@@ -3151,9 +3085,9 @@ ValueObject::ExpandArraySliceExpression(
         {
             case '[':
             {
-                if (!root_clang_type_info.Test(ClangASTContext::eTypeIsArray) && !root_clang_type_info.Test(ClangASTContext::eTypeIsPointer)) // if this is not a T[] nor a T*
+                if (!root_clang_type_info.Test(ClangASTType::eTypeIsArray) && !root_clang_type_info.Test(ClangASTType::eTypeIsPointer)) // if this is not a T[] nor a T*
                 {
-                    if (!root_clang_type_info.Test(ClangASTContext::eTypeIsScalar)) // if this is not even a scalar, this syntax is just plain wrong!
+                    if (!root_clang_type_info.Test(ClangASTType::eTypeIsScalar)) // if this is not even a scalar, this syntax is just plain wrong!
                     {
                         *first_unparsed = expression_cstr;
                         *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid;
@@ -3170,7 +3104,7 @@ ValueObject::ExpandArraySliceExpression(
                 }
                 if (*(expression_cstr+1) == ']') // if this is an unbounded range it only works for arrays
                 {
-                    if (!root_clang_type_info.Test(ClangASTContext::eTypeIsArray))
+                    if (!root_clang_type_info.Test(ClangASTType::eTypeIsArray))
                     {
                         *first_unparsed = expression_cstr;
                         *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
@@ -3214,7 +3148,7 @@ ValueObject::ExpandArraySliceExpression(
                     }
                     if (end - expression_cstr == 1) // if this is [], only return a valid value for arrays
                     {
-                        if (root_clang_type_info.Test(ClangASTContext::eTypeIsArray))
+                        if (root_clang_type_info.Test(ClangASTType::eTypeIsArray))
                         {
                             const size_t max_index = root->GetNumChildren() - 1;
                             for (size_t index = 0; index < max_index; index++)
@@ -3237,7 +3171,7 @@ ValueObject::ExpandArraySliceExpression(
                         }
                     }
                     // from here on we do have a valid index
-                    if (root_clang_type_info.Test(ClangASTContext::eTypeIsArray))
+                    if (root_clang_type_info.Test(ClangASTType::eTypeIsArray))
                     {
                         root = root->GetChildAtIndex(index, true);
                         if (!root.get())
@@ -3256,10 +3190,10 @@ ValueObject::ExpandArraySliceExpression(
                             return 1;
                         }
                     }
-                    else if (root_clang_type_info.Test(ClangASTContext::eTypeIsPointer))
+                    else if (root_clang_type_info.Test(ClangASTType::eTypeIsPointer))
                     {
                         if (*what_next == ValueObject::eExpressionPathAftermathDereference &&  // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
-                            pointee_clang_type_info.Test(ClangASTContext::eTypeIsScalar))
+                            pointee_clang_type_info.Test(ClangASTType::eTypeIsScalar))
                         {
                             Error error;
                             root = root->Dereference(error);
@@ -3341,7 +3275,7 @@ ValueObject::ExpandArraySliceExpression(
                         index_lower = index_higher;
                         index_higher = temp;
                     }
-                    if (root_clang_type_info.Test(ClangASTContext::eTypeIsScalar)) // expansion only works for scalars
+                    if (root_clang_type_info.Test(ClangASTType::eTypeIsScalar)) // expansion only works for scalars
                     {
                         root = root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
                         if (!root.get())
@@ -3360,9 +3294,9 @@ ValueObject::ExpandArraySliceExpression(
                             return 1;
                         }
                     }
-                    else if (root_clang_type_info.Test(ClangASTContext::eTypeIsPointer) && // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
+                    else if (root_clang_type_info.Test(ClangASTType::eTypeIsPointer) && // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
                              *what_next == ValueObject::eExpressionPathAftermathDereference &&
-                             pointee_clang_type_info.Test(ClangASTContext::eTypeIsScalar))
+                             pointee_clang_type_info.Test(ClangASTType::eTypeIsScalar))
                     {
                         Error error;
                         root = root->Dereference(error);
@@ -3431,12 +3365,11 @@ DumpValueObject_Impl (Stream &s,
                 valobj = dynamic_value;
         }
         
-        clang_type_t clang_type = valobj->GetClangType();
-
-        const Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, NULL, NULL));
+        ClangASTType clang_type = valobj->GetClangType();
+        const Flags type_flags (clang_type.GetTypeInfo ());
         const char *err_cstr = NULL;
-        const bool has_children = type_flags.Test (ClangASTContext::eTypeHasChildren);
-        const bool has_value = type_flags.Test (ClangASTContext::eTypeHasValue);
+        const bool has_children = type_flags.Test (ClangASTType::eTypeHasChildren);
+        const bool has_value = type_flags.Test (ClangASTType::eTypeHasValue);
         
         const bool print_valobj = options.m_flat_output == false || has_value;
         
@@ -3521,7 +3454,7 @@ DumpValueObject_Impl (Stream &s,
         }
         else
         {
-            const bool is_ref = type_flags.Test (ClangASTContext::eTypeIsReference);
+            const bool is_ref = type_flags.Test (ClangASTType::eTypeIsReference);
             if (print_valobj)
             {
                 if (is_nil)
@@ -3573,7 +3506,7 @@ DumpValueObject_Impl (Stream &s,
                 // current pointer depth below...
                 uint32_t curr_ptr_depth = ptr_depth;
 
-                const bool is_ptr = type_flags.Test (ClangASTContext::eTypeIsPointer);
+                const bool is_ptr = type_flags.Test (ClangASTType::eTypeIsPointer);
                 if (is_ptr || is_ref)
                 {
                     // We have a pointer or reference whose value is an address.
@@ -3742,7 +3675,6 @@ ValueObject::CreateConstantValue (const
     if (UpdateValueIfNeeded(false) && m_error.Success())
     {
         ExecutionContext exe_ctx (GetExecutionContextRef());
-        clang::ASTContext *ast = GetClangAST ();
         
         DataExtractor data;
         data.SetByteOrder (m_data.GetByteOrder());
@@ -3751,13 +3683,12 @@ ValueObject::CreateConstantValue (const
         if (IsBitfield())
         {
             Value v(Scalar(GetValueAsUnsigned(UINT64_MAX)));
-            m_error = v.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
+            m_error = v.GetValueAsData (&exe_ctx, data, 0, GetModule().get());
         }
         else
-            m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
+            m_error = m_value.GetValueAsData (&exe_ctx, data, 0, GetModule().get());
         
         valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), 
-                                                    ast,
                                                     GetClangType(),
                                                     name,
                                                     data,
@@ -3791,27 +3722,24 @@ ValueObject::Dereference (Error &error)
         bool child_is_base_class = false;
         bool child_is_deref_of_parent = false;
         const bool transparent_pointers = false;
-        clang::ASTContext *clang_ast = GetClangAST();
-        clang_type_t clang_type = GetClangType();
-        clang_type_t child_clang_type;
+        ClangASTType clang_type = GetClangType();
+        ClangASTType child_clang_type;
 
         ExecutionContext exe_ctx (GetExecutionContextRef());
         
-        child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (&exe_ctx,
-                                                                      clang_ast,
-                                                                      GetName().GetCString(),
-                                                                      clang_type,
-                                                                      0,
-                                                                      transparent_pointers,
-                                                                      omit_empty_base_classes,
-                                                                      ignore_array_bounds,
-                                                                      child_name_str,
-                                                                      child_byte_size,
-                                                                      child_byte_offset,
-                                                                      child_bitfield_bit_size,
-                                                                      child_bitfield_bit_offset,
-                                                                      child_is_base_class,
-                                                                      child_is_deref_of_parent);
+        child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
+                                                                GetName().GetCString(),
+                                                                0,
+                                                                transparent_pointers,
+                                                                omit_empty_base_classes,
+                                                                ignore_array_bounds,
+                                                                child_name_str,
+                                                                child_byte_size,
+                                                                child_byte_offset,
+                                                                child_bitfield_bit_size,
+                                                                child_bitfield_bit_offset,
+                                                                child_is_base_class,
+                                                                child_is_deref_of_parent);
         if (child_clang_type && child_byte_size)
         {
             ConstString child_name;
@@ -3819,7 +3747,6 @@ ValueObject::Dereference (Error &error)
                 child_name.SetCString (child_name_str.c_str());
 
             m_deref_valobj = new ValueObjectChild (*this,
-                                                   clang_ast,
                                                    child_clang_type,
                                                    child_name,
                                                    child_byte_size,
@@ -3876,16 +3803,14 @@ ValueObject::AddressOf (Error &error)
         case eAddressTypeLoad:
         case eAddressTypeHost:
             {
-                clang::ASTContext *ast = GetClangAST();
-                clang_type_t clang_type = GetClangType();
-                if (ast && clang_type)
+                ClangASTType clang_type = GetClangType();
+                if (clang_type)
                 {
                     std::string name (1, '&');
                     name.append (m_name.AsCString(""));
                     ExecutionContext exe_ctx (GetExecutionContextRef());
                     m_addr_of_valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                                          ast, 
-                                                                          ClangASTContext::CreatePointerType (ast, clang_type),
+                                                                          clang_type.GetPointerType(),
                                                                           ConstString (name.c_str()),
                                                                           addr, 
                                                                           eAddressTypeInvalid,
@@ -4104,103 +4029,6 @@ ValueObject::EvaluationPoint::SetUpdated
 }
         
 
-//bool
-//ValueObject::EvaluationPoint::SetContext (ExecutionContextScope *exe_scope)
-//{
-//    if (!IsValid())
-//        return false;
-//    
-//    bool needs_update = false;
-//    
-//    // The target has to be non-null, and the 
-//    Target *target = exe_scope->CalculateTarget();
-//    if (target != NULL)
-//    {
-//        Target *old_target = m_target_sp.get();
-//        assert (target == old_target);
-//        Process *process = exe_scope->CalculateProcess();
-//        if (process != NULL)
-//        {
-//            // FOR NOW - assume you can't update variable objects across process boundaries.
-//            Process *old_process = m_process_sp.get();
-//            assert (process == old_process);
-//            ProcessModID current_mod_id = process->GetModID();
-//            if (m_mod_id != current_mod_id)
-//            {
-//                needs_update = true;
-//                m_mod_id = current_mod_id;
-//            }
-//            // See if we're switching the thread or stack context.  If no thread is given, this is
-//            // being evaluated in a global context.            
-//            Thread *thread = exe_scope->CalculateThread();
-//            if (thread != NULL)
-//            {
-//                user_id_t new_thread_index = thread->GetIndexID();
-//                if (new_thread_index != m_thread_id)
-//                {
-//                    needs_update = true;
-//                    m_thread_id = new_thread_index;
-//                    m_stack_id.Clear();
-//                }
-//                
-//                StackFrame *new_frame = exe_scope->CalculateStackFrame();
-//                if (new_frame != NULL)
-//                {
-//                    if (new_frame->GetStackID() != m_stack_id)
-//                    {
-//                        needs_update = true;
-//                        m_stack_id = new_frame->GetStackID();
-//                    }
-//                }
-//                else
-//                {
-//                    m_stack_id.Clear();
-//                    needs_update = true;
-//                }
-//            }
-//            else
-//            {
-//                // If this had been given a thread, and now there is none, we should update.
-//                // Otherwise we don't have to do anything.
-//                if (m_thread_id != LLDB_INVALID_UID)
-//                {
-//                    m_thread_id = LLDB_INVALID_UID;
-//                    m_stack_id.Clear();
-//                    needs_update = true;
-//                }
-//            }
-//        }
-//        else
-//        {
-//            // If there is no process, then we don't need to update anything.
-//            // But if we're switching from having a process to not, we should try to update.
-//            if (m_process_sp.get() != NULL)
-//            {
-//                needs_update = true;
-//                m_process_sp.reset();
-//                m_thread_id = LLDB_INVALID_UID;
-//                m_stack_id.Clear();
-//            }
-//        }
-//    }
-//    else
-//    {
-//        // If there's no target, nothing can change so we don't need to update anything.
-//        // But if we're switching from having a target to not, we should try to update.
-//        if (m_target_sp.get() != NULL)
-//        {
-//            needs_update = true;
-//            m_target_sp.reset();
-//            m_process_sp.reset();
-//            m_thread_id = LLDB_INVALID_UID;
-//            m_stack_id.Clear();
-//        }
-//    }
-//    if (!m_needs_update)
-//        m_needs_update = needs_update;
-//        
-//    return needs_update;
-//}
 
 void
 ValueObject::ClearUserVisibleData(uint32_t clear_mask)
@@ -4262,24 +4090,30 @@ ValueObject::CreateValueObjectFromAddres
                                            const ExecutionContext& exe_ctx,
                                            ClangASTType type)
 {
-    ClangASTType pointer_type(type.GetASTContext(),type.GetPointerType());
-    lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
-    lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                                             pointer_type.GetASTContext(),
-                                                                             pointer_type.GetOpaqueQualType(),
-                                                                             ConstString(name),
-                                                                             buffer,
-                                                                             lldb::endian::InlHostByteOrder(),
-                                                                             exe_ctx.GetAddressByteSize()));
-    if (ptr_result_valobj_sp)
-    {
-        ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
-        Error err;
-        ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
-        if (ptr_result_valobj_sp && name && *name)
-            ptr_result_valobj_sp->SetName(ConstString(name));
+    if (type)
+    {
+        ClangASTType pointer_type(type.GetPointerType());
+        if (pointer_type)
+        {
+            lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
+            lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
+                                                                                     pointer_type,
+                                                                                     ConstString(name),
+                                                                                     buffer,
+                                                                                     lldb::endian::InlHostByteOrder(),
+                                                                                     exe_ctx.GetAddressByteSize()));
+            if (ptr_result_valobj_sp)
+            {
+                ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
+                Error err;
+                ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
+                if (ptr_result_valobj_sp && name && *name)
+                    ptr_result_valobj_sp->SetName(ConstString(name));
+            }
+            return ptr_result_valobj_sp;
+        }
     }
-    return ptr_result_valobj_sp;
+    return lldb::ValueObjectSP();
 }
 
 lldb::ValueObjectSP
@@ -4290,8 +4124,7 @@ ValueObject::CreateValueObjectFromData (
 {
     lldb::ValueObjectSP new_value_sp;
     new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                   type.GetASTContext() ,
-                                                   type.GetOpaqueQualType(),
+                                                   type,
                                                    ConstString(name),
                                                    data,
                                                    LLDB_INVALID_ADDRESS);

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectCast.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectCast.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectCast.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectCast.cpp Wed Jul 17 17:17:41 2013
@@ -54,35 +54,30 @@ ValueObjectCast::ValueObjectCast
     m_cast_type (cast_type)
 {
     SetName (name);
-    m_value.SetContext (Value::eContextTypeClangType, cast_type.GetOpaqueQualType());
+    //m_value.SetContext (Value::eContextTypeClangType, cast_type.GetOpaqueQualType());
+    m_value.SetClangType (cast_type);
 }
 
 ValueObjectCast::~ValueObjectCast()
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectCast::GetClangTypeImpl ()
 {
-    return m_cast_type.GetOpaqueQualType();
+    return m_cast_type;
 }
 
 size_t
 ValueObjectCast::CalculateNumChildren()
 {
-    return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
-}
-
-clang::ASTContext *
-ValueObjectCast::GetClangASTImpl ()
-{
-    return m_cast_type.GetASTContext();
+    return GetClangType().GetNumChildren (true);
 }
 
 uint64_t
 ValueObjectCast::GetByteSize()
 {
-    return m_value.GetValueByteSize(GetClangAST(), NULL);
+    return m_value.GetValueByteSize(NULL);
 }
 
 lldb::ValueType
@@ -103,9 +98,11 @@ ValueObjectCast::UpdateValue ()
         Value old_value(m_value);
         m_update_point.SetUpdated();
         m_value = m_parent->GetValue();
-        m_value.SetContext (Value::eContextTypeClangType, GetClangType());
+        ClangASTType clang_type (GetClangType());
+        //m_value.SetContext (Value::eContextTypeClangType, clang_type);
+        m_value.SetClangType (clang_type);
         SetAddressTypeOfChildren(m_parent->GetAddressTypeOfChildren());
-        if (ClangASTContext::IsAggregateType (GetClangType()))
+        if (clang_type.IsAggregateType ())
         {
             // this value object represents an aggregate type whose
             // children have values, but this object does not. So we
@@ -113,7 +110,7 @@ ValueObjectCast::UpdateValue ()
             SetValueDidChange (m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
         } 
         ExecutionContext exe_ctx (GetExecutionContextRef());
-        m_error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+        m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
         SetValueDidChange (m_parent->GetValueDidChange());
         return true;
     }

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectChild.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectChild.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectChild.cpp Wed Jul 17 17:17:41 2013
@@ -27,8 +27,7 @@ using namespace lldb_private;
 ValueObjectChild::ValueObjectChild
 (
     ValueObject &parent,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
+    const ClangASTType &clang_type,
     const ConstString &name,
     uint64_t byte_size,
     int32_t byte_offset,
@@ -39,7 +38,6 @@ ValueObjectChild::ValueObjectChild
     AddressType child_ptr_or_ref_addr_type
 ) :
     ValueObject (parent),
-    m_clang_ast (clang_ast),
     m_clang_type (clang_type),
     m_byte_size (byte_size),
     m_byte_offset (byte_offset),
@@ -65,7 +63,7 @@ ValueObjectChild::GetValueType() const
 size_t
 ValueObjectChild::CalculateNumChildren()
 {
-    return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
+    return GetClangType().GetNumChildren (true);
 }
 
 ConstString
@@ -73,7 +71,7 @@ ValueObjectChild::GetTypeName()
 {
     if (m_type_name.IsEmpty())
     {
-        m_type_name = ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
+        m_type_name = GetClangType().GetConstTypeName ();
         if (m_type_name)
         {
             if (m_bitfield_bit_size > 0)
@@ -94,7 +92,7 @@ ValueObjectChild::GetTypeName()
 ConstString
 ValueObjectChild::GetQualifiedTypeName()
 {
-    ConstString qualified_name = ClangASTType::GetConstQualifiedTypeName (GetClangAST(), GetClangType());
+    ConstString qualified_name = GetClangType().GetConstTypeName();
     if (qualified_name)
     {
         if (m_bitfield_bit_size > 0)
@@ -121,14 +119,14 @@ ValueObjectChild::UpdateValue ()
     {
         if (parent->UpdateValueIfNeeded(false))
         {
-            m_value.SetContext(Value::eContextTypeClangType, GetClangType());
+            m_value.SetClangType(GetClangType());
 
             // Copy the parent scalar value and the scalar value type
             m_value.GetScalar() = parent->GetValue().GetScalar();
             Value::ValueType value_type = parent->GetValue().GetValueType();
             m_value.SetValueType (value_type);
 
-            if (ClangASTContext::IsPointerOrReferenceType (parent->GetClangType()))
+            if (parent->GetClangType().IsPointerOrReferenceType ())
             {
                 lldb::addr_t addr = parent->GetPointerValue ();
                 m_value.GetScalar() = addr;
@@ -209,7 +207,7 @@ ValueObjectChild::UpdateValue ()
             if (m_error.Success())
             {
                 ExecutionContext exe_ctx (GetExecutionContextRef().Lock());
-                m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST (), m_data, 0, GetModule().get());
+                m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
             }
         }
         else

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResult.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResult.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResult.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResult.cpp Wed Jul 17 17:17:41 2013
@@ -30,13 +30,10 @@ using namespace lldb;
 using namespace lldb_private;
 
 ValueObjectSP
-ValueObjectConstResult::Create
-(
-    ExecutionContextScope *exe_scope,
-    ByteOrder byte_order, 
-     uint32_t addr_byte_size,
-     lldb::addr_t address
-)
+ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
+                                ByteOrder byte_order,
+                                uint32_t addr_byte_size,
+                                lldb::addr_t address)
 {
     return (new ValueObjectConstResult (exe_scope,
                                         byte_order,
@@ -44,15 +41,11 @@ ValueObjectConstResult::Create
                                         address))->GetSP();
 }
 
-ValueObjectConstResult::ValueObjectConstResult
-(
-    ExecutionContextScope *exe_scope,
-    ByteOrder byte_order, 
-    uint32_t addr_byte_size,
-    lldb::addr_t address
-) :
+ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
+                                                ByteOrder byte_order,
+                                                uint32_t addr_byte_size,
+                                                lldb::addr_t address) :
     ValueObject (exe_scope),
-    m_clang_ast (NULL),
     m_type_name (),
     m_byte_size (0),
     m_impl(this, address)
@@ -68,32 +61,25 @@ ValueObjectSP
 ValueObjectConstResult::Create
 (
     ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
+    const ClangASTType &clang_type,
     const ConstString &name,
     const DataExtractor &data,
     lldb::addr_t address
 )
 {
     return (new ValueObjectConstResult (exe_scope,
-                                        clang_ast,
                                         clang_type,
                                         name,
                                         data,
                                         address))->GetSP();
 }
 
-ValueObjectConstResult::ValueObjectConstResult
-(
-    ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
-    const ConstString &name,
-    const DataExtractor &data,
-    lldb::addr_t address
-) :
+ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
+                                                const ClangASTType &clang_type,
+                                                const ConstString &name,
+                                                const DataExtractor &data,
+                                                lldb::addr_t address) :
     ValueObject (exe_scope),
-    m_clang_ast (clang_ast),
     m_type_name (),
     m_byte_size (0),
     m_impl(this, address)
@@ -108,7 +94,7 @@ ValueObjectConstResult::ValueObjectConst
     
     m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
     m_value.SetValueType(Value::eValueTypeHostAddress);
-    m_value.SetContext(Value::eContextTypeClangType, clang_type);
+    m_value.SetClangType(clang_type);
     m_name = name;
     SetIsConstant ();
     SetValueIsValid(true);
@@ -116,20 +102,15 @@ ValueObjectConstResult::ValueObjectConst
 }
 
 ValueObjectSP
-ValueObjectConstResult::Create
-(
-    ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
-    const ConstString &name,
-    const lldb::DataBufferSP &data_sp,
-    lldb::ByteOrder data_byte_order, 
-    uint32_t data_addr_size,
-    lldb::addr_t address
-)
+ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
+                                const ClangASTType &clang_type,
+                                const ConstString &name,
+                                const lldb::DataBufferSP &data_sp,
+                                lldb::ByteOrder data_byte_order,
+                                uint32_t data_addr_size,
+                                lldb::addr_t address)
 {
     return (new ValueObjectConstResult (exe_scope,
-                                        clang_ast,
                                         clang_type,
                                         name,
                                         data_sp,
@@ -140,26 +121,20 @@ ValueObjectConstResult::Create
 
 ValueObjectSP
 ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
-        clang::ASTContext *clang_ast,
-        Value &value,
-        const ConstString &name)
+                                Value &value,
+                                const ConstString &name)
 {
-    return (new ValueObjectConstResult (exe_scope, clang_ast, value, name))->GetSP();
+    return (new ValueObjectConstResult (exe_scope, value, name))->GetSP();
 }
 
-ValueObjectConstResult::ValueObjectConstResult
-(
-    ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
-    const ConstString &name,
-    const lldb::DataBufferSP &data_sp,
-    lldb::ByteOrder data_byte_order, 
-    uint32_t data_addr_size,
-    lldb::addr_t address
-) :
+ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
+                                                const ClangASTType &clang_type,
+                                                const ConstString &name,
+                                                const lldb::DataBufferSP &data_sp,
+                                                lldb::ByteOrder data_byte_order, 
+                                                uint32_t data_addr_size,
+                                                lldb::addr_t address) :
     ValueObject (exe_scope),
-    m_clang_ast (clang_ast),
     m_type_name (),
     m_byte_size (0),
     m_impl(this, address)
@@ -169,7 +144,8 @@ ValueObjectConstResult::ValueObjectConst
     m_data.SetData(data_sp);
     m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
     m_value.SetValueType(Value::eValueTypeHostAddress);
-    m_value.SetContext(Value::eContextTypeClangType, clang_type);
+    //m_value.SetContext(Value::eContextTypeClangType, clang_type);
+    m_value.SetClangType (clang_type);
     m_name = name;
     SetIsConstant ();
     SetValueIsValid(true);
@@ -177,19 +153,14 @@ ValueObjectConstResult::ValueObjectConst
 }
 
 ValueObjectSP
-ValueObjectConstResult::Create
-(
-    ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
-    const ConstString &name,
-    lldb::addr_t address,
-    AddressType address_type,
-    uint32_t addr_byte_size
-)
+ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
+                                const ClangASTType &clang_type,
+                                const ConstString &name,
+                                lldb::addr_t address,
+                                AddressType address_type,
+                                uint32_t addr_byte_size)
 {
     return (new ValueObjectConstResult (exe_scope,
-                                        clang_ast,
                                         clang_type,
                                         name,
                                         address,
@@ -197,18 +168,13 @@ ValueObjectConstResult::Create
                                         addr_byte_size))->GetSP();
 }
 
-ValueObjectConstResult::ValueObjectConstResult 
-(
-    ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
-    const ConstString &name,
-    lldb::addr_t address,
-    AddressType address_type,
-    uint32_t addr_byte_size
-) :
+ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
+                                                const ClangASTType &clang_type,
+                                                const ConstString &name,
+                                                lldb::addr_t address,
+                                                AddressType address_type,
+                                                uint32_t addr_byte_size) :
     ValueObject (exe_scope),
-    m_clang_ast (clang_ast),
     m_type_name (),
     m_byte_size (0),
     m_impl(this, address)
@@ -224,7 +190,8 @@ ValueObjectConstResult::ValueObjectConst
     case eAddressTypeLoad:      m_value.SetValueType(Value::eValueTypeLoadAddress); break;    
     case eAddressTypeHost:      m_value.SetValueType(Value::eValueTypeHostAddress); break;
     }
-    m_value.SetContext(Value::eContextTypeClangType, clang_type);
+//    m_value.SetContext(Value::eContextTypeClangType, clang_type);
+    m_value.SetClangType (clang_type);
     m_name = name;
     SetIsConstant ();
     SetValueIsValid(true);
@@ -242,11 +209,9 @@ ValueObjectConstResult::Create
                                         error))->GetSP();
 }
 
-ValueObjectConstResult::ValueObjectConstResult (
-    ExecutionContextScope *exe_scope,
-    const Error& error) :
+ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
+                                                const Error& error) :
     ValueObject (exe_scope),
-    m_clang_ast (NULL),
     m_type_name (),
     m_byte_size (0),
     m_impl(this)
@@ -255,13 +220,10 @@ ValueObjectConstResult::ValueObjectConst
     SetIsConstant ();
 }
 
-ValueObjectConstResult::ValueObjectConstResult (
-    ExecutionContextScope *exe_scope,
-    clang::ASTContext *clang_ast,
-    const Value &value,
-    const ConstString &name) :
+ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
+                                                const Value &value,
+                                                const ConstString &name) :
     ValueObject (exe_scope),
-    m_clang_ast (clang_ast),
     m_type_name (),
     m_byte_size (0),
     m_impl(this)
@@ -274,7 +236,7 @@ ValueObjectConstResult::~ValueObjectCons
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectConstResult::GetClangTypeImpl()
 {
     return m_value.GetClangType();
@@ -290,7 +252,7 @@ uint64_t
 ValueObjectConstResult::GetByteSize()
 {
     if (m_byte_size == 0)
-        m_byte_size = ClangASTType::GetTypeByteSize(GetClangAST(), GetClangType());
+        m_byte_size = GetClangType().GetByteSize();
     return m_byte_size;
 }
 
@@ -303,20 +265,14 @@ ValueObjectConstResult::SetByteSize (siz
 size_t
 ValueObjectConstResult::CalculateNumChildren()
 {
-    return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
-}
-
-clang::ASTContext *
-ValueObjectConstResult::GetClangASTImpl ()
-{
-    return m_clang_ast;
+    return GetClangType().GetNumChildren (true);
 }
 
 ConstString
 ValueObjectConstResult::GetTypeName()
 {
     if (m_type_name.IsEmpty())
-        m_type_name = ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
+        m_type_name = GetClangType().GetConstTypeName ();
     return m_type_name;
 }
 

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultChild.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultChild.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultChild.cpp Wed Jul 17 17:17:41 2013
@@ -19,8 +19,7 @@ using namespace lldb_private;
 ValueObjectConstResultChild::ValueObjectConstResultChild
 (
     ValueObject &parent,
-    clang::ASTContext *clang_ast,
-    void *clang_type,
+    const ClangASTType &clang_type,
     const ConstString &name,
     uint32_t byte_size,
     int32_t byte_offset,
@@ -30,7 +29,6 @@ ValueObjectConstResultChild::ValueObject
     bool is_deref_of_parent
 ) :
     ValueObjectChild (parent,
-                      clang_ast,
                       clang_type,
                       name,
                       byte_size,

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultImpl.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultImpl.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectConstResultImpl.cpp Wed Jul 17 17:17:41 2013
@@ -55,7 +55,6 @@ ValueObjectConstResultImpl::DerefOnTarge
         lldb::addr_t tgt_address = m_impl_backend->GetPointerValue();
         ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef());
         m_load_addr_backend = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                              m_impl_backend->GetClangAST(),
                                                               m_impl_backend->GetClangType(),
                                                               m_impl_backend->GetName(),
                                                               tgt_address,
@@ -104,27 +103,24 @@ ValueObjectConstResultImpl::CreateChildA
     bool child_is_deref_of_parent = false;
     
     const bool transparent_pointers = synthetic_array_member == false;
-    clang::ASTContext *clang_ast = m_impl_backend->GetClangAST();
-    lldb::clang_type_t clang_type = m_impl_backend->GetClangType();
-    lldb::clang_type_t child_clang_type;
+    ClangASTType clang_type = m_impl_backend->GetClangType();
+    ClangASTType child_clang_type;
     
     ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef());
     
-    child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (&exe_ctx,
-                                                                  clang_ast,
-                                                                  m_impl_backend->GetName().GetCString(),
-                                                                  clang_type,
-                                                                  idx,
-                                                                  transparent_pointers,
-                                                                  omit_empty_base_classes,
-                                                                  ignore_array_bounds,
-                                                                  child_name_str,
-                                                                  child_byte_size,
-                                                                  child_byte_offset,
-                                                                  child_bitfield_bit_size,
-                                                                  child_bitfield_bit_offset,
-                                                                  child_is_base_class,
-                                                                  child_is_deref_of_parent);
+    child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
+                                                            m_impl_backend->GetName().GetCString(),
+                                                            idx,
+                                                            transparent_pointers,
+                                                            omit_empty_base_classes,
+                                                            ignore_array_bounds,
+                                                            child_name_str,
+                                                            child_byte_size,
+                                                            child_byte_offset,
+                                                            child_bitfield_bit_size,
+                                                            child_bitfield_bit_offset,
+                                                            child_is_base_class,
+                                                            child_is_deref_of_parent);
     if (child_clang_type && child_byte_size)
     {
         if (synthetic_index)
@@ -135,7 +131,6 @@ ValueObjectConstResultImpl::CreateChildA
             child_name.SetCString (child_name_str.c_str());
         
         valobj = new ValueObjectConstResultChild (*m_impl_backend,
-                                                  clang_ast,
                                                   child_clang_type,
                                                   child_name,
                                                   child_byte_size,
@@ -178,7 +173,7 @@ ValueObjectConstResultImpl::AddressOf (E
         return lldb::ValueObjectSP();
     if (m_live_address != LLDB_INVALID_ADDRESS)
     {
-        ClangASTType type(m_impl_backend->GetClangAST(), m_impl_backend->GetClangType());
+        ClangASTType clang_type(m_impl_backend->GetClangType());
         
         lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&m_live_address,sizeof(lldb::addr_t)));
         
@@ -186,8 +181,7 @@ ValueObjectConstResultImpl::AddressOf (E
         new_name.append(m_impl_backend->GetName().AsCString(""));
         ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef());
         m_address_of_backend = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                               type.GetASTContext(),
-                                                               type.GetPointerType(),
+                                                               clang_type.GetPointerType(),
                                                                ConstString(new_name.c_str()),
                                                                buffer,
                                                                lldb::endian::InlHostByteOrder(), 

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectDynamicValue.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectDynamicValue.cpp Wed Jul 17 17:17:41 2013
@@ -49,7 +49,7 @@ ValueObjectDynamicValue::~ValueObjectDyn
     m_owning_valobj_sp.reset();
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectDynamicValue::GetClangTypeImpl ()
 {
     if (m_dynamic_type_info.HasTypeSP())
@@ -65,7 +65,7 @@ ValueObjectDynamicValue::GetTypeName()
     if (success)
     {
         if (m_dynamic_type_info.HasTypeSP())
-            return ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
+            return GetClangType().GetConstTypeName();
         if (m_dynamic_type_info.HasName())
             return m_dynamic_type_info.GetName();
     }
@@ -79,7 +79,7 @@ ValueObjectDynamicValue::GetQualifiedTyp
     if (success)
     {
         if (m_dynamic_type_info.HasTypeSP())
-            return ClangASTType::GetConstQualifiedTypeName (GetClangAST(), GetClangType());
+            return GetClangType().GetConstQualifiedTypeName ();
         if (m_dynamic_type_info.HasName())
             return m_dynamic_type_info.GetName();
     }
@@ -91,27 +91,17 @@ ValueObjectDynamicValue::CalculateNumChi
 {
     const bool success = UpdateValueIfNeeded(false);
     if (success && m_dynamic_type_info.HasTypeSP())
-        return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
+        return GetClangType().GetNumChildren (true);
     else
         return m_parent->GetNumChildren();
 }
 
-clang::ASTContext *
-ValueObjectDynamicValue::GetClangASTImpl ()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success && m_dynamic_type_info.HasTypeSP())
-        return m_dynamic_type_info.GetTypeSP()->GetClangAST();
-    else
-        return m_parent->GetClangAST ();
-}
-
 uint64_t
 ValueObjectDynamicValue::GetByteSize()
 {
     const bool success = UpdateValueIfNeeded(false);
     if (success && m_dynamic_type_info.HasTypeSP())
-        return m_value.GetValueByteSize(GetClangAST(), NULL);
+        return m_value.GetValueByteSize(NULL);
     else
         return m_parent->GetByteSize();
 }
@@ -196,7 +186,7 @@ ValueObjectDynamicValue::UpdateValue ()
         ClearDynamicTypeInformation();
         m_dynamic_type_info.Clear();
         m_value = m_parent->GetValue();
-        m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+        m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
         return m_error.Success();
     }
     
@@ -234,21 +224,18 @@ ValueObjectDynamicValue::UpdateValue ()
         m_value.GetScalar() = load_address;
     }
     
-    lldb::clang_type_t corrected_type;
+    ClangASTType corrected_type;
     if (m_dynamic_type_info.HasTypeSP())
     {
         // The type will always be the type of the dynamic object.  If our parent's type was a pointer,
         // then our type should be a pointer to the type of the dynamic object.  If a reference, then the original type
         // should be okay...
-        lldb::clang_type_t orig_type;
-        clang::ASTContext* ast;
-        orig_type = m_dynamic_type_info.GetTypeSP()->GetClangForwardType();
-        ast = m_dynamic_type_info.GetTypeSP()->GetClangAST();
+        ClangASTType orig_type = m_dynamic_type_info.GetTypeSP()->GetClangForwardType();
         corrected_type = orig_type;
         if (m_parent->IsPointerType())
-            corrected_type = ClangASTContext::CreatePointerType (ast, orig_type);
+            corrected_type = orig_type.GetPointerType ();
         else if (m_parent->IsPointerOrReferenceType())
-            corrected_type = ClangASTContext::CreateLValueReferenceType (ast, orig_type);
+            corrected_type = orig_type.GetLValueReferenceType ();
     }
     else /*if (m_dynamic_type_info.HasName())*/
     {
@@ -262,7 +249,8 @@ ValueObjectDynamicValue::UpdateValue ()
         m_dynamic_type_info.SetName(type_name_buf.c_str());
     }
     
-    m_value.SetContext (Value::eContextTypeClangType, corrected_type);
+    //m_value.SetContext (Value::eContextTypeClangType, corrected_type);
+    m_value.SetClangType (corrected_type);
     
     // Our address is the location of the dynamic type stored in memory.  It isn't a load address,
     // because we aren't pointing to the LOCATION that stores the pointer to us, we're pointing to us...
@@ -278,10 +266,10 @@ ValueObjectDynamicValue::UpdateValue ()
     {
         // The variable value is in the Scalar value inside the m_value.
         // We can point our m_data right to it.
-        m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+        m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
         if (m_error.Success())
         {
-            if (ClangASTContext::IsAggregateType (GetClangType()))
+            if (GetClangType().IsAggregateType ())
             {
                 // this value object represents an aggregate type whose
                 // children have values, but this object does not. So we

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectMemory.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectMemory.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectMemory.cpp Wed Jul 17 17:17:41 2013
@@ -103,7 +103,8 @@ ValueObjectMemory::ValueObjectMemory (Ex
     TargetSP target_sp (GetTargetSP());
 
     SetName (ConstString(name));
-    m_value.SetContext(Value::eContextTypeClangType, m_clang_type.GetOpaqueQualType());
+//    m_value.SetContext(Value::eContextTypeClangType, m_clang_type.GetOpaqueQualType());
+    m_value.SetClangType(m_clang_type);
     lldb::addr_t load_address = m_address.GetLoadAddress (target_sp.get());
     if (load_address != LLDB_INVALID_ADDRESS)
     {
@@ -130,12 +131,12 @@ ValueObjectMemory::~ValueObjectMemory()
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectMemory::GetClangTypeImpl ()
 {
     if (m_type_sp)
         return m_type_sp->GetClangForwardType();
-    return m_clang_type.GetOpaqueQualType();
+    return m_clang_type;
 }
 
 ConstString
@@ -143,7 +144,7 @@ ValueObjectMemory::GetTypeName()
 {
     if (m_type_sp)
         return m_type_sp->GetName();
-    return ClangASTType::GetConstTypeName (GetClangAST(), m_clang_type.GetOpaqueQualType());
+    return m_clang_type.GetConstTypeName();
 }
 
 size_t
@@ -152,17 +153,7 @@ ValueObjectMemory::CalculateNumChildren(
     if (m_type_sp)
         return m_type_sp->GetNumChildren(true);
     const bool omit_empty_base_classes = true;
-    return ClangASTContext::GetNumChildren (m_clang_type.GetASTContext(),
-                                            m_clang_type.GetOpaqueQualType(), 
-                                            omit_empty_base_classes);
-}
-
-clang::ASTContext *
-ValueObjectMemory::GetClangASTImpl ()
-{
-    if (m_type_sp)
-        return m_type_sp->GetClangAST();
-    return m_clang_type.GetASTContext();
+    return m_clang_type.GetNumChildren (omit_empty_base_classes);
 }
 
 uint64_t
@@ -170,7 +161,7 @@ ValueObjectMemory::GetByteSize()
 {
     if (m_type_sp)
         return m_type_sp->GetByteSize();
-    return m_clang_type.GetClangTypeByteSize ();
+    return m_clang_type.GetByteSize ();
 }
 
 lldb::ValueType
@@ -209,7 +200,7 @@ ValueObjectMemory::UpdateValue ()
         case Value::eValueTypeScalar:
             // The variable value is in the Scalar value inside the m_value.
             // We can point our m_data right to it.
-            m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+            m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
             break;
 
         case Value::eValueTypeFileAddress:
@@ -234,7 +225,7 @@ ValueObjectMemory::UpdateValue ()
                 }
             }
 
-            if (ClangASTContext::IsAggregateType (GetClangType()))
+            if (GetClangType().IsAggregateType())
             {
                 // this value object represents an aggregate type whose
                 // children have values, but this object does not. So we
@@ -249,9 +240,12 @@ ValueObjectMemory::UpdateValue ()
                 if (m_type_sp)
                     value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
                 else
-                    value.SetContext(Value::eContextTypeClangType, m_clang_type.GetOpaqueQualType());
+                {
+                    //value.SetContext(Value::eContextTypeClangType, m_clang_type.GetOpaqueQualType());
+                    value.SetClangType(m_clang_type);
+                }
 
-                m_error = value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+                m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
             }
             break;
         }

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectRegister.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectRegister.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectRegister.cpp Wed Jul 17 17:17:41 2013
@@ -42,10 +42,10 @@ ValueObjectRegisterContext::~ValueObject
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectRegisterContext::GetClangTypeImpl ()
 {
-    return NULL;
+    return ClangASTType();
 }
 
 ConstString
@@ -66,12 +66,6 @@ ValueObjectRegisterContext::CalculateNum
     return m_reg_ctx_sp->GetRegisterSetCount();
 }
 
-clang::ASTContext *
-ValueObjectRegisterContext::GetClangASTImpl ()
-{
-    return NULL;
-}
-
 uint64_t
 ValueObjectRegisterContext::GetByteSize()
 {
@@ -144,10 +138,10 @@ ValueObjectRegisterSet::~ValueObjectRegi
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectRegisterSet::GetClangTypeImpl ()
 {
-    return NULL;
+    return ClangASTType();
 }
 
 ConstString
@@ -171,12 +165,6 @@ ValueObjectRegisterSet::CalculateNumChil
     return 0;
 }
 
-clang::ASTContext *
-ValueObjectRegisterSet::GetClangASTImpl ()
-{
-    return NULL;
-}
-
 uint64_t
 ValueObjectRegisterSet::GetByteSize()
 {
@@ -285,7 +273,7 @@ ValueObjectRegister::ValueObjectRegister
     m_reg_info (),
     m_reg_value (),
     m_type_name (),
-    m_clang_type (NULL)
+    m_clang_type ()
 {
     assert (reg_ctx_sp.get());
     ConstructObject(reg_num);
@@ -303,7 +291,7 @@ ValueObjectRegister::ValueObjectRegister
     m_reg_info (),
     m_reg_value (),
     m_type_name (),
-    m_clang_type (NULL)
+    m_clang_type ()
 {
     assert (reg_ctx);
     ConstructObject(reg_num);
@@ -313,10 +301,10 @@ ValueObjectRegister::~ValueObjectRegiste
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectRegister::GetClangTypeImpl ()
 {
-    if (m_clang_type == NULL)
+    if (!m_clang_type.IsValid())
     {
         ExecutionContext exe_ctx (GetExecutionContextRef());
         Target *target = exe_ctx.GetTargetPtr();
@@ -337,28 +325,14 @@ ConstString
 ValueObjectRegister::GetTypeName()
 {
     if (m_type_name.IsEmpty())
-        m_type_name = ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
+        m_type_name = GetClangType().GetConstTypeName ();
     return m_type_name;
 }
 
 size_t
 ValueObjectRegister::CalculateNumChildren()
 {
-    return ClangASTContext::GetNumChildren(GetClangAST(), GetClangType(), true);
-}
-
-clang::ASTContext *
-ValueObjectRegister::GetClangASTImpl ()
-{
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    Target *target = exe_ctx.GetTargetPtr();
-    if (target)
-    {
-        Module *exe_module = target->GetExecutableModulePointer();
-        if (exe_module)
-            return exe_module->GetClangASTContext().getASTContext();
-    }
-    return NULL;
+    return GetClangType().GetNumChildren(true);
 }
 
 uint64_t

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectSyntheticFilter.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectSyntheticFilter.cpp Wed Jul 17 17:17:41 2013
@@ -83,7 +83,7 @@ ValueObjectSynthetic::~ValueObjectSynthe
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectSynthetic::GetClangTypeImpl ()
 {
     return m_parent->GetClangType();
@@ -128,13 +128,6 @@ ValueObjectSynthetic::MightHaveChildren(
     return (m_might_have_children == eLazyBoolNo ? false : true);
 }
 
-
-clang::ASTContext *
-ValueObjectSynthetic::GetClangASTImpl ()
-{
-    return m_parent->GetClangAST ();
-}
-
 uint64_t
 ValueObjectSynthetic::GetByteSize()
 {
@@ -273,5 +266,5 @@ ValueObjectSynthetic::CopyParentData ()
 {
     m_value = m_parent->GetValue();
     ExecutionContext exe_ctx (GetExecutionContextRef());
-    m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+    m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
 }

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObjectVariable.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObjectVariable.cpp Wed Jul 17 17:17:41 2013
@@ -54,13 +54,13 @@ ValueObjectVariable::~ValueObjectVariabl
 {
 }
 
-lldb::clang_type_t
+ClangASTType
 ValueObjectVariable::GetClangTypeImpl ()
 {
     Type *var_type = m_variable_sp->GetType();
     if (var_type)
         return var_type->GetClangForwardType();
-    return NULL;
+    return ClangASTType();
 }
 
 ConstString
@@ -84,34 +84,24 @@ ValueObjectVariable::GetQualifiedTypeNam
 size_t
 ValueObjectVariable::CalculateNumChildren()
 {    
-    ClangASTType type(GetClangAST(),
-                      GetClangType());
+    ClangASTType type(GetClangType());
     
     if (!type.IsValid())
         return 0;
     
     const bool omit_empty_base_classes = true;
-    return ClangASTContext::GetNumChildren(type.GetASTContext(), type.GetOpaqueQualType(), omit_empty_base_classes);
-}
-
-clang::ASTContext *
-ValueObjectVariable::GetClangASTImpl ()
-{
-    Type *var_type = m_variable_sp->GetType();
-    if (var_type)
-        return var_type->GetClangAST();
-    return 0;
+    return type.GetNumChildren(omit_empty_base_classes);
 }
 
 uint64_t
 ValueObjectVariable::GetByteSize()
 {
-    ClangASTType type(GetClangAST(), GetClangType());
+    ClangASTType type(GetClangType());
     
     if (!type.IsValid())
         return 0;
     
-    return type.GetClangTypeByteSize();
+    return type.GetByteSize();
 }
 
 lldb::ValueType
@@ -162,7 +152,7 @@ ValueObjectVariable::UpdateValue ()
                 loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (target);
         }
         Value old_value(m_value);
-        if (expr.Evaluate (&exe_ctx, GetClangAST(), NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error))
+        if (expr.Evaluate (&exe_ctx, NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error))
         {
             m_resolved_value = m_value;
             m_value.SetContext(Value::eContextTypeVariable, variable);
@@ -191,7 +181,7 @@ ValueObjectVariable::UpdateValue ()
             case Value::eValueTypeScalar:
                 // The variable value is in the Scalar value inside the m_value.
                 // We can point our m_data right to it.
-                m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+                m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
                 break;
 
             case Value::eValueTypeFileAddress:
@@ -231,7 +221,7 @@ ValueObjectVariable::UpdateValue ()
                     }
                 }
 
-                if (ClangASTContext::IsAggregateType (GetClangType()))
+                if (GetClangType().IsAggregateType())
                 {
                     // this value object represents an aggregate type whose
                     // children have values, but this object does not. So we
@@ -244,7 +234,7 @@ ValueObjectVariable::UpdateValue ()
                     // so it can extract read its value into m_data appropriately
                     Value value(m_value);
                     value.SetContext(Value::eContextTypeVariable, variable);
-                    m_error = value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0, GetModule().get());
+                    m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
                 }
                 break;
             }

Removed: lldb/branches/lldb-platform-work/source/Core/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/cxa_demangle.cpp?rev=186539&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/cxa_demangle.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/cxa_demangle.cpp (removed)
@@ -1,11036 +0,0 @@
-//===-------------------------- cxa_demangle.cpp --------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/cxa_demangle.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <new>
-#include <algorithm>
-#include <assert.h>
-
-#ifdef DEBUGGING
-
-#include <string>
-#include <typeinfo>
-
-#endif
-
-namespace lldb_cxxabiv1
-{
-
-namespace __libcxxabi
-{
-
-#pragma GCC visibility push(hidden)
-
-class __node
-{
-    __node(const __node&);
-    __node& operator=(const __node&);
-public:
-    const char* __name_;
-    size_t __size_;
-    __node* __left_;
-    __node* __right_;
-    long __cached_size_;
-    long double __value_;
-public:
-    __node()
-        : __name_(0), __size_(0), __left_(0), __right_(0), __cached_size_(-1)
-        {}
-    virtual ~__node() {};
-
-    void reset_cached_size()
-    {
-        __cached_size_ = -1;
-        if (__left_)
-            __left_->reset_cached_size();
-        if (__right_)
-            __right_->reset_cached_size();
-    }
-
-    virtual size_t first_size() const  {return 0;}
-    virtual size_t second_size() const {return 0;}
-    virtual size_t size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(first_size() + second_size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const {return buf;}
-    virtual char* second_demangled_name(char* buf) const {return buf;}
-    virtual char* get_demangled_name(char* buf) const
-    {
-        return second_demangled_name(first_demangled_name(buf));
-    }
-    virtual size_t base_size() const {return size();}
-    virtual char* get_base_name(char* buf) const
-    {
-        return get_demangled_name(buf);
-    }
-
-    virtual bool ends_with_template(bool /*parsing*/ = false) const
-    {
-        return false;
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return false;
-    }
-    virtual __node* base_name() const
-    {
-        return const_cast<__node*>(this);
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return false;
-    }
-    virtual bool is_function() const
-    {
-        return false;
-    }
-    virtual bool is_cv_qualifer() const
-    {
-        return false;
-    }
-    virtual bool is_array() const
-    {
-        return false;
-    }
-
-    virtual bool fix_forward_references(__node**, __node**)
-    {
-        return true;
-    }
-    virtual __node* extract_cv(__node*&) const
-    {
-        return 0;
-    }
-    virtual size_t list_len() const
-    {
-        return 0;
-    }
-    virtual bool is_sub() const
-    {
-        return false;
-    }
-};
-
-#ifdef DEBUGGING
-
-void display(__node* x, int indent = 0)
-{
-    if (x)
-    {
-        for (int i = 0; i < 2*indent; ++i)
-            printf(" ");
-        size_t sz = x->size();
-        char* buf = (char*)calloc(sz+10, 1);
-        x->get_demangled_name(buf);
-        printf("%s [%ld] %s, %p\n", typeid(*x).name(), sz, buf, x);
-        if (strlen(buf) != sz)
-        {
-            printf("strlen(buf) = %ld and size = %ld\n", strlen(buf), sz);
-        }
-        free(buf);
-        display(x->__left_, indent+1);
-        display(x->__right_, indent+1);
-    }
-}
-
-#endif
-
-class __vtable
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("vtable for ") - 1;
-public:
-    __vtable(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = n + static_cast<long>(__right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "vtable for ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __VTT
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("VTT for ") - 1;
-public:
-    __VTT(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = n + static_cast<long>(__right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "VTT for ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __construction_vtable
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("construction vtable for ") - 1 + 4;
-public:
-    __construction_vtable(__node* left, __node* right)
-    {
-        __left_ = left;
-        __right_ = right;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = n + static_cast<long>(__left_->size()
-                                                  + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "construction vtable for ", n-4);
-        buf =  __left_->get_demangled_name(buf+n-4);
-        *buf++ = '-';
-        *buf++ = 'i';
-        *buf++ = 'n';
-        *buf++ = '-';
-        return __right_->get_demangled_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = __left_->fix_forward_references(t_begin, t_end);
-        return r && __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __typeinfo
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("typeinfo for ") - 1;
-public:
-    __typeinfo(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = n + static_cast<long>(__right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "typeinfo for ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __typeinfo_name
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("typeinfo name for ") - 1;
-public:
-    __typeinfo_name(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = n + static_cast<long>(__right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "typeinfo name for ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __covariant_return_thunk
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("covariant return thunk to ") - 1;
-public:
-    __covariant_return_thunk(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = n + static_cast<long>(__right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "covariant return thunk to ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __virtual_thunk
-    : public __node
-{
-    static const size_t n = sizeof("virtual thunk to ") - 1;
-public:
-    __virtual_thunk(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(n + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "virtual thunk to ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __non_virtual_thunk
-    : public __node
-{
-    static const size_t n = sizeof("non-virtual thunk to ") - 1;
-public:
-    __non_virtual_thunk(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(n + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "non-virtual thunk to ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __guard_variable
-    : public __node
-{
-    static const size_t n = sizeof("guard variable for ") - 1;
-public:
-    __guard_variable(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(n + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "guard variable for ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __reference_temporary
-    : public __node
-{
-    static const size_t n = sizeof("reference temporary for ") - 1;
-public:
-    __reference_temporary(__node* type)
-    {
-        __right_ = type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(n + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "reference temporary for ", n);
-        return __right_->get_demangled_name(buf+n);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __source_name
-    : public __node
-{
-public:
-    __source_name(const char* __name, size_t __size)
-    {
-        __name_ = __name;
-        __size_ = __size;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__size_ >= 10 && strncmp(__name_, "_GLOBAL__N", 10) == 0)
-                const_cast<long&>(__cached_size_) = 21;
-            else
-                const_cast<long&>(__cached_size_) = static_cast<long>(__size_);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_ >= 10 && strncmp(__name_, "_GLOBAL__N", 10) == 0)
-            return strncpy(buf, "(anonymous namespace)", 21) + 21;
-        return strncpy(buf, __name_, __size_) + __size_;
-    }
-};
-
-class __operator_new
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const {return sizeof("operator new") - 1;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return strncpy(buf, "operator new", sizeof("operator new") - 1) +
-                                            sizeof("operator new") - 1;
-    }
-};
-
-class __operator_new_array
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const {return sizeof("operator new[]") - 1;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return strncpy(buf, "operator new[]", sizeof("operator new[]") - 1) +
-                                              sizeof("operator new[]") - 1;
-    }
-};
-
-class __operator_delete
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const {return sizeof("operator delete") - 1;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return strncpy(buf, "operator delete", sizeof("operator delete") - 1) +
-                                               sizeof("operator delete") - 1;
-    }
-};
-
-class __operator_delete_array
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const {return sizeof("operator delete[]") - 1;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return strncpy(buf, "operator delete[]", sizeof("operator delete[]") - 1) +
-                                                 sizeof("operator delete[]") - 1;
-    }
-};
-
-class __operator_logical_and
-    : public __node
-{
-public:
-
-    __operator_logical_and() {}
-    __operator_logical_and(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator&&") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") && (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator&&", sizeof("operator&&") - 1);
-            buf += sizeof("operator&&") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_addressof
-    : public __node
-{
-public:
-
-    __operator_addressof() {}
-    explicit __operator_addressof(__node* op)
-    {
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(3 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator&") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '&';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator&", sizeof("operator&") - 1);
-            buf += sizeof("operator&") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_bit_and
-    : public __node
-{
-public:
-
-    __operator_bit_and() {}
-    __operator_bit_and(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator&") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") & (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator&", sizeof("operator&") - 1);
-            buf += sizeof("operator&") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_and_equal
-    : public __node
-{
-public:
-
-    __operator_and_equal() {}
-    __operator_and_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator&=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") &= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator&=", sizeof("operator&=") - 1);
-            buf += sizeof("operator&=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_equal
-    : public __node
-{
-public:
-
-    __operator_equal() {}
-    __operator_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") = (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator=", sizeof("operator=") - 1);
-            buf += sizeof("operator=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_alignof_type
-    : public __node
-{
-public:
-
-    __operator_alignof_type() {}
-    __operator_alignof_type(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__right_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 10);
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator alignof") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__right_)
-        {
-            strncpy(buf, "alignof (", 9);
-            buf += 9;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator alignof", sizeof("operator alignof") - 1);
-            buf += sizeof("operator alignof") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__right_)
-            return __right_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_alignof_expression
-    : public __node
-{
-public:
-
-    __operator_alignof_expression() {}
-    __operator_alignof_expression(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__right_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 10);
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator alignof") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__right_)
-        {
-            strncpy(buf, "alignof (", 9);
-            buf += 9;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator alignof", sizeof("operator alignof") - 1);
-            buf += sizeof("operator alignof") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__right_)
-            return __right_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_paren
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const {return sizeof("operator()") - 1;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "operator()", sizeof("operator()") - 1);
-        return buf + sizeof("operator()") - 1;
-    }
-};
-
-class __operator_comma
-    : public __node
-{
-public:
-
-    __operator_comma() {}
-    __operator_comma(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator,") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") , (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator,", sizeof("operator,") - 1);
-            buf += sizeof("operator,") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_tilda
-    : public __node
-{
-public:
-
-    __operator_tilda() {}
-    explicit __operator_tilda(__node* op)
-    {
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(3 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator~") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '~';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator~", sizeof("operator~") - 1);
-            buf += sizeof("operator~") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_cast
-    : public __node
-{
-    static const size_t n = sizeof("operator ") - 1;
-public:
-
-    explicit __operator_cast(__node* type)
-    {
-        __right_ = type;
-    }
-    __operator_cast(__node* type, __node* arg)
-    {
-        __size_ = 1;
-        __right_ = type;
-        __left_ = arg;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off;
-            if (__size_)
-            {
-                off = 4;
-                off += __right_->size();
-                if (__left_)
-                    off += __left_->size();
-            }
-            else
-                off = n +  __right_->size();;
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            *buf++ = '(';
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-            *buf++ = '(';
-            if (__left_)
-                buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator ", n);
-            buf = __right_->get_demangled_name(buf+n);
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return true;
-    }
-};
-
-class __cast_literal
-    : public __node
-{
-public:
-
-    __cast_literal(__node* type, const char* f, const char* l)
-    {
-        __left_ = type;
-        __name_ = f;
-        __size_ = static_cast<size_t>(l - f);
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(2 +
-                                                   __left_->size() + __size_);
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        *buf++ = '(';
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = ')';
-        strncpy(buf, __name_, __size_);
-        return buf + __size_;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __operator_dereference
-    : public __node
-{
-public:
-
-    __operator_dereference() {}
-    explicit __operator_dereference(__node* op)
-    {
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(3 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator*") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '*';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator*", sizeof("operator*") - 1);
-            buf += sizeof("operator*") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_divide
-    : public __node
-{
-public:
-
-    __operator_divide() {}
-    __operator_divide(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator/") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") / (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator/", sizeof("operator/") - 1);
-            buf += sizeof("operator/") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_divide_equal
-    : public __node
-{
-public:
-
-    __operator_divide_equal() {}
-    __operator_divide_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator/=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") /= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator/=", sizeof("operator/=") - 1);
-            buf += sizeof("operator/=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_xor
-    : public __node
-{
-public:
-
-    __operator_xor() {}
-    __operator_xor(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator^") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") ^ (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator^", sizeof("operator^") - 1);
-            buf += sizeof("operator^") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_xor_equal
-    : public __node
-{
-public:
-
-    __operator_xor_equal() {}
-    __operator_xor_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator^=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';  // strncpy(buf, "(", 1);
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") ^= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator^=", sizeof("operator^=") - 1);
-            buf += sizeof("operator^=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_equality
-    : public __node
-{
-public:
-
-    __operator_equality() {}
-    __operator_equality(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator==") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") == (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator==", sizeof("operator==") - 1);
-            buf += sizeof("operator==") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_greater_equal
-    : public __node
-{
-public:
-
-    __operator_greater_equal() {}
-    __operator_greater_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator>=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") >= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator>=", sizeof("operator>=") - 1);
-            buf += sizeof("operator>=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_greater
-    : public __node
-{
-public:
-
-    __operator_greater() {}
-    __operator_greater(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                        __left_->size() + 9 +
-                                                        __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator>") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") > (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator>", sizeof("operator>") - 1);
-            buf += sizeof("operator>") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_brackets
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const {return sizeof("operator[]") - 1;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "operator[]", sizeof("operator[]") - 1);
-        return buf + sizeof("operator[]") - 1;
-    }
-};
-
-class __operator_less_equal
-    : public __node
-{
-public:
-
-    __operator_less_equal() {}
-    __operator_less_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator<=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") <= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator<=", sizeof("operator<=") - 1);
-            buf += sizeof("operator<=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_less
-    : public __node
-{
-public:
-
-    __operator_less() {}
-    __operator_less(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator<") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") < (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator<", sizeof("operator<") - 1);
-            buf += sizeof("operator<") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_left_shift
-    : public __node
-{
-public:
-
-    __operator_left_shift() {}
-    __operator_left_shift(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator<<") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") << (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator<<", sizeof("operator<<") - 1);
-            buf += sizeof("operator<<") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_left_shift_equal
-    : public __node
-{
-public:
-
-    __operator_left_shift_equal() {}
-    __operator_left_shift_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                        __left_->size() + 9 +
-                                                        __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator<<=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") <<= (", 7);
-            buf += 7;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator<<=", sizeof("operator<<=") - 1);
-            buf += sizeof("operator<<=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_minus
-    : public __node
-{
-public:
-
-    __operator_minus() {}
-    __operator_minus(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator-") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") - (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator-", sizeof("operator-") - 1);
-            buf += sizeof("operator-") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_minus_equal
-    : public __node
-{
-public:
-
-    __operator_minus_equal() {}
-    __operator_minus_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator-=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") -= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator-=", sizeof("operator-=") - 1);
-            buf += sizeof("operator-=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_times
-    : public __node
-{
-public:
-
-    __operator_times() {}
-    __operator_times(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator*") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") * (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator*", sizeof("operator*") - 1);
-            buf += sizeof("operator*") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_times_equal
-    : public __node
-{
-public:
-
-    __operator_times_equal() {}
-    __operator_times_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator*=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") *= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator*=", sizeof("operator*=") - 1);
-            buf += sizeof("operator*=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_decrement
-    : public __node
-{
-public:
-
-    __operator_decrement() {}
-    explicit __operator_decrement(bool prefix, __node* op)
-    {
-        __size_ = prefix;
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(4 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator--") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            if (__size_)
-            {
-                *buf++ = '-';
-                *buf++ = '-';
-                *buf++ = '(';
-            }
-            else
-                *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            if (__size_)
-                *buf++ = ')';
-            else
-            {
-                *buf++ = ')';
-                *buf++ = '-';
-                *buf++ = '-';
-            }
-        }
-        else
-        {
-            strncpy(buf, "operator--", sizeof("operator--") - 1);
-            buf += sizeof("operator--") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_not_equal
-    : public __node
-{
-public:
-
-    __operator_not_equal() {}
-    __operator_not_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator!=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") != (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator!=", sizeof("operator!=") - 1);
-            buf += sizeof("operator!=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_negate
-    : public __node
-{
-public:
-
-    __operator_negate() {}
-    explicit __operator_negate(__node* op)
-    {
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(3 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator-") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '-';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator-", sizeof("operator-") - 1);
-            buf += sizeof("operator-") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_logical_not
-    : public __node
-{
-public:
-
-    __operator_logical_not() {}
-    explicit __operator_logical_not(__node* op)
-    {
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(3 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator!") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '!';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator!", sizeof("operator!") - 1);
-            buf += sizeof("operator!") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_logical_or
-    : public __node
-{
-public:
-
-    __operator_logical_or() {}
-    __operator_logical_or(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator||") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") || (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator||", sizeof("operator||") - 1);
-            buf += sizeof("operator||") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_bit_or
-    : public __node
-{
-public:
-
-    __operator_bit_or() {}
-    __operator_bit_or(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator|") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") | (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator|", sizeof("operator|") - 1);
-            buf += sizeof("operator|") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_or_equal
-    : public __node
-{
-public:
-
-    __operator_or_equal() {}
-    __operator_or_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator|=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") |= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator|=", sizeof("operator|=") - 1);
-            buf += sizeof("operator|=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_pointer_to_member
-    : public __node
-{
-public:
-
-    __operator_pointer_to_member() {}
-    __operator_pointer_to_member(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                        __left_->size() + 9 +
-                                                        __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator->*") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") ->* (", 7);
-            buf += 7;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator->*", sizeof("operator->*") - 1);
-            buf += sizeof("operator->*") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_plus
-    : public __node
-{
-public:
-
-    __operator_plus() {}
-    __operator_plus(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator+") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") + (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator+", sizeof("operator+") - 1);
-            buf += sizeof("operator+") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_plus_equal
-    : public __node
-{
-public:
-
-    __operator_plus_equal() {}
-    __operator_plus_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator+=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") += (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator+=", sizeof("operator+=") - 1);
-            buf += sizeof("operator+=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_increment
-    : public __node
-{
-public:
-
-    __operator_increment() {}
-    explicit __operator_increment(bool prefix, __node* op)
-    {
-        __size_ = prefix;
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(4 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator++") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            if (__size_)
-            {
-                *buf++ = '+';
-                *buf++ = '+';
-                *buf++ = '(';
-            }
-            else
-                *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            if (__size_)
-                *buf++ = ')';
-            else
-            {
-                *buf++ = ')';
-                *buf++ = '+';
-                *buf++ = '+';
-            }
-        }
-        else
-        {
-            strncpy(buf, "operator++", sizeof("operator++") - 1);
-            buf += sizeof("operator++") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_unary_plus
-    : public __node
-{
-public:
-
-    __operator_unary_plus() {}
-    explicit __operator_unary_plus(__node* op)
-    {
-        __left_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(3 + __left_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator+") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '+';
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator+", sizeof("operator+") - 1);
-            buf += sizeof("operator+") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_)
-            return __left_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_arrow
-    : public __node
-{
-public:
-
-    __operator_arrow() {}
-    __operator_arrow(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator->") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") -> (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator->", sizeof("operator->") - 1);
-            buf += sizeof("operator->") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_conditional
-    : public __node
-{
-public:
-
-    __operator_conditional() {}
-    __operator_conditional(__node* op1, __node* op2, __node* op3)
-    {
-        __name_ = (const char*)op1;
-        __left_ = op2;
-        __right_ = op3;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-            {
-                __node* op1 = (__node*)__name_;
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                        op1->size() +
-                                                        __left_->size() + 12 +
-                                                        __right_->size());
-            }
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator?") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            __node* op1 = (__node*)__name_;
-            *buf++ = '(';
-            buf = op1->get_demangled_name(buf);
-            strncpy(buf, ") ? (", 5);
-            buf += 5;
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") : (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator?", sizeof("operator?") - 1);
-            buf += sizeof("operator?") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__name_)
-            r = r && ((__node*)__name_)->fix_forward_references(t_begin, t_end);
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_mod
-    : public __node
-{
-public:
-
-    __operator_mod() {}
-    __operator_mod(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 7 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator%") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") % (", 5);
-            buf += 5;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator%", sizeof("operator%") - 1);
-            buf += sizeof("operator%") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_mod_equal
-    : public __node
-{
-public:
-
-    __operator_mod_equal() {}
-    __operator_mod_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator%=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") %= (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator%=", sizeof("operator%=") - 1);
-            buf += sizeof("operator%=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_right_shift
-    : public __node
-{
-public:
-
-    __operator_right_shift() {}
-    __operator_right_shift(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                       __left_->size() + 8 +
-                                                       __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator>>") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") >> (", 6);
-            buf += 6;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator>>", sizeof("operator>>") - 1);
-            buf += sizeof("operator>>") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_right_shift_equal
-    : public __node
-{
-public:
-
-    __operator_right_shift_equal() {}
-    __operator_right_shift_equal(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(
-                                                        __left_->size() + 9 +
-                                                        __right_->size());
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator>>=") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            strncpy(buf, ") >>= (", 7);
-            buf += 7;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator>>=", sizeof("operator>>=") - 1);
-            buf += sizeof("operator>>=") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __operator_sizeof_type
-    : public __node
-{
-public:
-
-    __operator_sizeof_type() {}
-    __operator_sizeof_type(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__right_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 9);
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator sizeof") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__right_)
-        {
-            strncpy(buf, "sizeof (", 8);
-            buf += 8;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator sizeof", sizeof("operator sizeof") - 1);
-            buf += sizeof("operator sizeof") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__right_)
-            return __right_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __operator_sizeof_expression
-    : public __node
-{
-public:
-
-    __operator_sizeof_expression() {}
-    __operator_sizeof_expression(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__right_)
-                const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 9);
-            else
-                const_cast<long&>(__cached_size_) = sizeof("operator sizeof") - 1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__right_)
-        {
-            strncpy(buf, "sizeof (", 8);
-            buf += 8;
-            buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        else
-        {
-            strncpy(buf, "operator sizeof", sizeof("operator sizeof") - 1);
-            buf += sizeof("operator sizeof") - 1;
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__right_)
-            return __right_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __typeid
-    : public __node
-{
-public:
-
-    __typeid(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 8);
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "typeid(", 7);
-        buf += 7;
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __throw
-    : public __node
-{
-public:
-
-    __throw(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 6);
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "throw ", 6);
-        return __right_->get_demangled_name(buf+6);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __rethrow
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("throw") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "throw", n);
-        return buf+n;
-    }
-};
-
-class __operator_sizeof_param_pack
-    : public __node
-{
-public:
-
-    __operator_sizeof_param_pack(__node* op)
-    {
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__right_->size() + 11);
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "sizeof...(", 10);
-        buf += 10;
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __const_cast
-    : public __node
-{
-public:
-
-    __const_cast(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                             14 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "const_cast<", 11);
-        buf += 11;
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '>';
-        *buf++ = '(';
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __dynamic_cast
-    : public __node
-{
-public:
-
-    __dynamic_cast(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                             16 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "dynamic_cast<", 13);
-        buf += 13;
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '>';
-        *buf++ = '(';
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __reinterpret_cast
-    : public __node
-{
-public:
-
-    __reinterpret_cast(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                             20 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "reinterpret_cast<", 17);
-        buf += 17;
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '>';
-        *buf++ = '(';
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __static_cast
-    : public __node
-{
-public:
-
-    __static_cast(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                             15 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "static_cast<", 12);
-        buf += 12;
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '>';
-        *buf++ = '(';
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __call_expr
-    : public __node
-{
-public:
-
-    __call_expr(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off = __left_->size() + 2;
-            if (__right_)
-                off += __right_->size();
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '(';
-        if (__right_)
-            buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __delete_array_expr
-    : public __node
-{
-public:
-
-    __delete_array_expr(bool global, __node* op)
-    {
-        __size_ = global;
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>((__size_ ? 2 : 0) +
-                                                               9 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            *buf++ = ':';
-            *buf++ = ':';
-        }
-        strncpy(buf, "delete[] ", 9);
-        return __right_->get_demangled_name(buf+9);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __delete_expr
-    : public __node
-{
-public:
-
-    __delete_expr(bool global, __node* op)
-    {
-        __size_ = global;
-        __right_ = op;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>((__size_ ? 2 : 0) +
-                                                               7 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            *buf++ = ':';
-            *buf++ = ':';
-        }
-        strncpy(buf, "delete ", 7);
-        return __right_->get_demangled_name(buf+7);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __new_expr
-    : public __node
-{
-public:
-
-    __new_expr(bool global, bool is_array, bool has_init,
-               __node* expr, __node* type, __node* init)
-    {
-        __size_ =  (unsigned)global         |
-                  ((unsigned)is_array << 1) |
-                  ((unsigned)has_init << 2);
-        __left_ = expr;
-        __name_ = (const char*)type;
-        __right_ = init;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off = 4;
-            if (__size_ & 1)
-                off += 2;
-            if (__size_ & 2)
-                off += 2;
-            if (__left_)
-            {
-                off += 2;
-                off += __left_->size();
-            }
-            __node* type = (__node*)__name_;
-            off += type->size();
-            if (__size_ & 4)
-            {
-                off += 2;
-                if (__right_)
-                    off += __right_->size();
-            }
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_ & 1)
-        {
-            *buf++ = ':';
-            *buf++ = ':';
-        }
-        *buf++ = 'n';
-        *buf++ = 'e';
-        *buf++ = 'w';
-        if (__size_ & 2)
-        {
-            *buf++ = '[';
-            *buf++ = ']';
-        }
-        if (__left_)
-        {
-            *buf++ = '(';
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        *buf++ = ' ';
-        __node* type = (__node*)__name_;
-        buf = type->get_demangled_name(buf);
-        if (__size_ & 4)
-        {
-            *buf++ = '(';
-            if (__right_)
-                buf = __right_->get_demangled_name(buf);
-            *buf++ = ')';
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        __node* type = (__node*)__name_;
-        bool r = type->fix_forward_references(t_begin, t_end);
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);;
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);;
-        return r;
-    }
-};
-
-class __dot_star_expr
-    : public __node
-{
-public:
-
-    __dot_star_expr(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                              2 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '.';
-        *buf++ = '*';
-        return __right_->get_demangled_name(buf);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __dot_expr
-    : public __node
-{
-public:
-
-    __dot_expr(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                              1 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '.';
-        return __right_->get_demangled_name(buf);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __arrow_expr
-    : public __node
-{
-public:
-
-    __arrow_expr(__node* op1, __node* op2)
-    {
-        __left_ = op1;
-        __right_ = op2;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                              2 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '-';
-        *buf++ = '>';
-        return __right_->get_demangled_name(buf);
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-              __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __std_qualified_name
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("std") - 1;
-public:
-
-    __std_qualified_name()
-    {
-    }
-    virtual size_t first_size() const
-    {
-        return n;
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        *buf++ = 's';
-        *buf++ = 't';
-        *buf++ = 'd';
-        return buf;
-    }
-};
-
-class __sub_allocator
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("std::allocator") - 1;
-public:
-
-    virtual size_t first_size() const
-    {
-        return n;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "std::allocator", n);
-        return buf + n;
-    }
-};
-
-class __sub_basic_string
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("std::basic_string") - 1;
-public:
-
-    virtual size_t first_size() const
-    {
-        return n;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "std::basic_string", n);
-        return buf + n;
-    }
-};
-
-class __sub_string
-    : public __node
-{
-    static const size_t n = sizeof("std::string") - 1;
-    static const size_t ne = sizeof("std::basic_string<char, std::char_traits<char>, std::allocator<char> >") - 1;
-public:
-
-    virtual size_t first_size() const
-    {
-        if (__size_)
-            return ne;
-        return n;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            strncpy(buf, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >", ne);
-            buf += ne;
-        }
-        else
-        {
-            strncpy(buf, "std::string", n);
-            buf += n;
-        }
-        return buf;
-    }
-
-    virtual size_t base_size() const
-    {
-        return 12;
-    }
-    virtual char* get_base_name(char* buf) const
-    {
-        strncpy(buf, "basic_string", 12);
-        return buf + 12;
-    }
-
-    virtual __node* base_name() const
-    {
-        const_cast<size_t&>(__size_) = true;
-        return const_cast<__node*>(static_cast<const __node*>(this));
-    }
-};
-
-class __sub_istream
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("std::istream") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "std::istream", n);
-        return buf + n;
-    }
-};
-
-class __sub_ostream
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("std::ostream") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "std::ostream", n);
-        return buf + n;
-    }
-};
-
-class __sub_iostream
-    : public __node
-{
-    static const ptrdiff_t n = sizeof("std::iostream") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "std::iostream", n);
-        return buf + n;
-    }
-};
-
-class __sub
-    : public __node
-{
-public:
-
-    explicit __sub(__node* arg)
-    {
-        __left_ = arg;
-    }
-    explicit __sub(size_t arg)
-    {
-        __size_ = arg;
-    }
-    virtual size_t first_size() const
-    {
-        return __left_->first_size();
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return __left_->first_demangled_name(buf);
-    }
-    virtual size_t second_size() const
-    {
-        return __left_->second_size();
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        return __left_->second_demangled_name(buf);
-    }
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        return __left_->ends_with_template(parsing);
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __left_->is_reference_or_pointer_to_function_or_array();
-    }
-    virtual bool is_function() const
-    {
-        if (__left_ == 0)
-            return false;
-        return __left_->is_function();
-    }
-    virtual bool is_cv_qualifer() const
-    {
-        return __left_->is_cv_qualifer();
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __left_->is_ctor_dtor_conv();
-    }
-    virtual bool is_array() const
-    {
-        return __left_->is_array();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__left_ == 0)
-        {
-            if (__size_ < static_cast<size_t>(t_end - t_begin))
-            {
-                __left_ = t_begin[__size_];
-                __size_ = 0;
-            }
-            else
-                return false;
-        }
-        return true;
-    }
-    virtual size_t list_len() const
-    {
-        return __left_->list_len();
-    }
-    virtual bool is_sub() const
-    {
-        return true;
-    }
-};
-
-class __unscoped_template_name
-    : public __node
-{
-public:
-    __unscoped_template_name(__node* name, __node* args)
-        {__left_ = name; __right_ = args;}
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                                  __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        return __right_->get_demangled_name(buf);
-    }
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        return __right_->ends_with_template(parsing);
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) && 
-               __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-// length == 0: __left_ == NULL
-// length == 1: __left_ != NULL, __right_ == NULL
-// length  > 1: __left_ != NULL, __right_ != NULL
-class __list
-    : public __node
-{
-public:
-    explicit __list(__node* type)
-        {__left_ = type;}
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            if (__left_ == NULL)
-                const_cast<long&>(__cached_size_) = 0;
-            else if (__right_ == NULL)
-                const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size());
-            else
-            {
-                size_t off = __right_->size();
-                if (off > 0)
-                    off += 2;
-                const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() + off);
-            }
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_ != NULL)
-        {
-            char* t = __left_->get_demangled_name(buf + (__size_ ? 2 : 0));
-            if (__size_ == 0)
-                buf = t;
-            else if (t != buf+2)
-            {
-                *buf++ = ',';
-                *buf++ = ' ';
-                buf = t;
-            }
-            if (__right_)
-                buf = __right_->get_demangled_name(buf);
-        }
-        return buf;
-    }
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        if (__right_ && __right_->size() > 0)
-        {
-            return __right_->ends_with_template(parsing);
-        }
-        else if (__left_ && __left_->size() > 0)
-        {
-            return __left_->ends_with_template(parsing);
-        }
-        return false;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-    virtual size_t list_len() const
-    {
-        if (!__left_)
-            return 0;
-        if (!__right_)
-            return 1;
-        return 1 + __right_->list_len();
-    }
-};
-
-class __template_args
-    : public __node
-{
-public:
-    __template_args(__node* name, __node* list)
-    {
-        __left_ = name;
-        __right_ = list;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off = 2;
-            if (__right_)
-            {
-                if (__right_->ends_with_template())
-                    ++off;
-                off += __right_->size();
-            }
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() + off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = '<';
-        if (__right_)
-        {
-            buf = __right_->get_demangled_name(buf);
-            if (buf[-1] == '>')
-                *buf++ = ' ';
-        }
-        *buf++ = '>';
-        return buf;
-    }
-    virtual bool ends_with_template(bool /*parsing*/ = false) const
-    {
-        return true;
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __left_->is_ctor_dtor_conv();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __function_args
-    : public __node
-{
-public:
-    __function_args(__node* list)
-        {__right_ = list;}
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(2 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        *buf++ = '(';
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class ___lambda_node
-    : public __node
-{
-public:
-    ___lambda_node(__node* params, const char *number, size_t number_size)
-    {
-        __right_ = params;
-        __name_ = number;
-        __size_ = number_size;
-    }
-  
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t r = 2;
-            r += sizeof("'lambda'")-1;
-            if (__right_)
-                r += __right_->size();
-            r += __size_;
-            const_cast<long&>(__cached_size_) = static_cast<long>(r);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        size_t n = sizeof("'lambda") - 1;
-        strncpy(buf, "'lambda", n);
-        buf += n;
-        if (__size_)
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        *buf++ = '\'';
-        *buf++ = '(';
-        if (__right_)
-          buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        if (__right_)
-            return __right_->fix_forward_references(t_begin, t_end);
-        return true;
-    }
-};
-
-class __unnamed
-    : public __node
-{
-public:
-    __unnamed(const char *number, size_t number_size)
-    {
-        __name_ = number;
-        __size_ = number_size;
-    }
-  
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t r = 0;
-            r += sizeof("'unnamed'")-1;
-            r += __size_;
-            const_cast<long&>(__cached_size_) = static_cast<long>(r);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        size_t n = sizeof("'unnamed") - 1;
-        strncpy(buf, "'unnamed", n);
-        buf += n;
-        if (__size_)
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        *buf++ = '\'';
-        return buf;
-    }
-};
-
-class __cv_qualifiers
-    : public __node
-{
-public:
-    __cv_qualifiers(size_t cv, __node* type)
-    {
-        __left_ = type;
-        __size_ = __left_->is_function() ? cv << 5 : cv;
-    }
-
-    virtual size_t first_size() const
-    {
-        size_t s = __left_->first_size();
-        if (__size_ & 4)
-            s += sizeof(" restrict")-1;
-        if (__size_ & 2)
-            s += sizeof(" volatile")-1;
-        if (__size_ & 1)
-            s += sizeof(" const")-1;
-        if (__size_ & 8)
-            s += sizeof(" &")-1;
-        if (__size_ & 16)
-            s += sizeof(" &&")-1;
-        return s;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->first_demangled_name(buf);
-        if (__size_ & 1)
-        {
-            const size_t n = sizeof(" const")-1;
-            strncpy(buf, " const", n);
-            buf += n;
-        }
-        if (__size_ & 2)
-        {
-            const size_t n = sizeof(" volatile")-1;
-            strncpy(buf, " volatile", n);
-            buf += n;
-        }
-        if (__size_ & 4)
-        {
-            const size_t n = sizeof(" restrict")-1;
-            strncpy(buf, " restrict", n);
-            buf += n;
-        }
-        if (__size_ & 8)
-        {
-            *buf++ = ' ';
-            *buf++ = '&';
-        }
-        if (__size_ & 16)
-        {
-            *buf++ = ' ';
-            *buf++ = '&';
-            *buf++ = '&';
-        }
-        return buf;
-    }
-    virtual size_t second_size() const
-    {
-        size_t s = __left_->second_size();
-        if (__size_ & 128)
-            s += sizeof(" restrict")-1;
-        if (__size_ & 64)
-            s += sizeof(" volatile")-1;
-        if (__size_ & 32)
-            s += sizeof(" const")-1;
-        if (__size_ & 256)
-            s += sizeof(" &")-1;
-        if (__size_ & 512)
-            s += sizeof(" &&")-1;
-        return s;
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        buf = __left_->second_demangled_name(buf);
-        if (__size_ & 32)
-        {
-            const size_t n = sizeof(" const")-1;
-            strncpy(buf, " const", n);
-            buf += n;
-        }
-        if (__size_ & 64)
-        {
-            const size_t n = sizeof(" volatile")-1;
-            strncpy(buf, " volatile", n);
-            buf += n;
-        }
-        if (__size_ & 128)
-        {
-            const size_t n = sizeof(" restrict")-1;
-            strncpy(buf, " restrict", n);
-            buf += n;
-        }
-        if (__size_ & 256)
-        {
-            *buf++ = ' ';
-            *buf++ = '&';
-        }
-        if (__size_ & 512)
-        {
-            *buf++ = ' ';
-            *buf++ = '&';
-            *buf++ = '&';
-        }
-        return buf;
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __left_->is_reference_or_pointer_to_function_or_array();
-    }
-    virtual bool is_function() const
-    {
-        return __left_->is_function();
-    }
-    virtual bool is_cv_qualifer() const
-    {
-        return true;
-    }
-    virtual __node* extract_cv(__node*& rt) const
-    {
-        if (rt == this)
-        {
-            rt = __left_;
-            return const_cast<__node*>(static_cast<const __node*>(this));
-        }
-        return 0;
-    }
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        if (parsing)
-            return __left_->ends_with_template(parsing);
-        return false;
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __left_->is_ctor_dtor_conv();
-    }
-    virtual bool is_array() const
-    {
-        return __left_->is_array();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-    virtual size_t list_len() const
-    {
-        return __left_->list_len();
-    }
-};
-
-class __extended_qualifier
-    : public __node
-{
-public:
-    __extended_qualifier(__node* name, __node* type)
-    {
-        __left_ = type;
-        __right_ = name;
-        __size_ = __left_->is_function() ? 1 : 0;
-    }
-
-    virtual size_t first_size() const
-    {
-        size_t s = __left_->first_size();
-        if (__size_ == 0)
-            s += __right_->size() + 1;
-        return s;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->first_demangled_name(buf);
-        if (__size_ == 0)
-        {
-            *buf++ = ' ';
-            buf = __right_->get_demangled_name(buf);
-        }
-        return buf;
-    }
-    virtual size_t second_size() const
-    {
-        size_t s = __left_->second_size();
-        if (__size_ == 1)
-            s += __right_->size() + 1;
-        return s;
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        buf = __left_->second_demangled_name(buf);
-        if (__size_ == 1)
-        {
-            *buf++ = ' ';
-            buf = __right_->get_demangled_name(buf);
-        }
-        return buf;
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __left_->is_reference_or_pointer_to_function_or_array();
-    }
-    virtual bool is_function() const
-    {
-        return __left_->is_function();
-    }
-    virtual bool is_cv_qualifer() const
-    {
-        return true;
-    }
-    virtual __node* extract_cv(__node*& rt) const
-    {
-        if (rt == this)
-        {
-            rt = __left_;
-            return const_cast<__node*>(static_cast<const __node*>(this));
-        }
-        return 0;
-    }
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        return __left_->ends_with_template(parsing);
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __left_->is_ctor_dtor_conv();
-    }
-    virtual bool is_array() const
-    {
-        return __left_->is_array();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-    virtual size_t list_len() const
-    {
-        return __left_->list_len();
-    }
-};
-
-class __function
-    : public __node
-{
-public:
-
-    __function(__node* name, __node* signature, size_t ret_goes_first = true)
-    {
-        __size_ = ret_goes_first;
-        __left_ = name;
-        __right_ = signature;
-    }
-
-    virtual size_t first_size() const
-    {
-        size_t off = 0;
-        if (__size_)
-        {
-            off = __right_->first_size();
-            if (off > 0 && (__left_ == NULL ||
-                            !__right_->__left_->is_reference_or_pointer_to_function_or_array()))
-                ++off;
-        }
-        else
-            off = 5;
-        if (__left_)
-            off += __left_->first_size();
-        else
-            ++off;
-        return off;
-    }
-
-    virtual size_t second_size() const
-    {
-        size_t off = 0;
-        if (__left_ == NULL)
-            off = 1;
-        off += __right_->second_size();
-        if (!__size_)
-        {
-            off += 2;
-            off += __right_->first_size();
-        }
-        return off;
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            const char* t = buf;
-            buf = __right_->first_demangled_name(buf);
-            if (buf != t && (__left_ == NULL ||
-                            !__right_->__left_->is_reference_or_pointer_to_function_or_array()))
-                *buf++ = ' ';
-        }
-        else
-        {
-            strncpy(buf, "auto ", 5);
-            buf += 5;
-        }
-        if (__left_)
-            buf = __left_->first_demangled_name(buf);
-        else
-            *buf++ = '(';
-        return buf;
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        if (__left_ == NULL)
-            *buf++ = ')';
-        buf = __right_->second_demangled_name(buf);
-        if (!__size_)
-        {
-            *buf++ = '-';
-            *buf++ = '>';
-            buf = __right_->first_demangled_name(buf);
-        }
-        return buf;
-    }
-    virtual char* get_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            const char* t = buf;
-            buf = __right_->first_demangled_name(buf);
-            if (buf != t && (__left_ == NULL ||
-                            !__right_->__left_->is_reference_or_pointer_to_function_or_array()))
-                *buf++ = ' ';
-        }
-        else
-        {
-            strncpy(buf, "auto ", 5);
-            buf += 5;
-        }
-        if (__left_)
-            buf = __left_->first_demangled_name(buf);
-        buf = __right_->second_demangled_name(buf);
-        if (!__size_)
-        {
-            *buf++ = '-';
-            *buf++ = '>';
-            buf = __right_->first_demangled_name(buf);
-        }
-        return buf;
-    }
-
-    virtual size_t size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off = 0;
-            if (__size_)
-            {
-                off = __right_->first_size();
-                if (off > 0 && (__left_ == NULL ||
-                                !__right_->__left_->is_reference_or_pointer_to_function_or_array()))
-                    ++off;
-            }
-            else
-                off = 5;
-            if (__left_)
-                off += __left_->first_size();
-            off += __right_->second_size();
-            if (!__size_)
-            {
-                off += 2;
-                off += __right_->first_size();
-            }
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual bool is_function() const
-    {
-        return true;
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __left_->is_ctor_dtor_conv();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __function_signature
-    : public __node
-{
-public:
-    __function_signature(__node* ret, __node* args)
-    {
-        __left_ = ret;
-        __right_ = args;
-    }
-    virtual size_t first_size() const
-    {
-        return __left_ ? __left_->first_size() : 0;
-    }
-
-    virtual size_t second_size() const
-    {
-        return 2 + (__right_ ? __right_->size() : 0)
-                 + (__left_ ? __left_->second_size() : 0);
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-            buf = __left_->first_demangled_name(buf);
-        return buf;
-    }
-
-    virtual char* second_demangled_name(char* buf) const
-    {
-        *buf++ = '(';
-        if (__right_)
-            buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        if (__left_)
-            buf = __left_->second_demangled_name(buf);
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = r && __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __pointer_to
-    : public __node
-{
-public:
-
-    explicit __pointer_to(__node* type)
-    {
-        __left_ = type;
-    }
-    virtual size_t first_size() const
-    {
-        return __left_->first_size() + (__left_->is_array() ? 3 : 1);
-    }
-    virtual size_t second_size() const
-    {
-        return __left_->second_size() + (__left_->is_array() ? 1 : 0);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->first_demangled_name(buf);
-        if (__left_->is_array())
-        {
-            *buf++ = ' ';
-            *buf++ = '(';
-            *buf++ = '*';
-        }
-        else
-            *buf++ = '*';
-        return buf;
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        if (__left_->is_array())
-            *buf++ = ')';
-        return __left_->second_demangled_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __left_->is_function() ||
-               __left_->is_reference_or_pointer_to_function_or_array();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-    virtual size_t list_len() const
-    {
-        return __left_->list_len();
-    }
-};
-
-class __lvalue_reference_to
-    : public __node
-{
-public:
-
-    explicit __lvalue_reference_to(__node* type)
-    {
-        __left_ = type;
-    }
-    virtual size_t first_size() const
-    {
-        return __left_->first_size() + (__left_->is_array() ? 3 : 1);
-    }
-    virtual size_t second_size() const
-    {
-        return __left_->second_size() + (__left_->is_array() ? 1 : 0);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->first_demangled_name(buf);
-        if (__left_->is_array())
-        {
-            *buf++ = ' ';
-            *buf++ = '(';
-            *buf++ = '&';
-        }
-        else
-            *buf++ = '&';
-        return buf;
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        if (__left_->is_array())
-            *buf++ = ')';
-        return __left_->second_demangled_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __left_->is_function();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-    virtual size_t list_len() const
-    {
-        return __left_->list_len();
-    }
-};
-
-class __rvalue_reference_to
-    : public __node
-{
-public:
-
-    explicit __rvalue_reference_to(__node* type)
-    {
-        __left_ = type;
-    }
-    virtual size_t first_size() const
-    {
-        return __left_->first_size() + (__left_->is_array() ? 4 : 2);
-    }
-    virtual size_t second_size() const
-    {
-        return __left_->second_size() + (__left_->is_array() ? 1 : 0);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->first_demangled_name(buf);
-        if (__left_->is_array())
-        {
-            strncpy(buf, " (&&", 4);
-            buf += 4;
-        }
-        else
-        {
-            *buf++ = '&';
-            *buf++ = '&';
-        }
-        return buf;
-    }
-    virtual char* second_demangled_name(char* buf) const
-    {
-        if (__left_->is_array())
-            *buf++ = ')';
-        return __left_->second_demangled_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __left_->is_function();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-    virtual size_t list_len() const
-    {
-        return __left_->list_len();
-    }
-};
-
-class __d_complex
-    : public __node
-{
-    static const size_t n = sizeof(" complex") - 1;
-public:
-
-    explicit __d_complex(__node* type)
-    {
-        __left_ = type;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(n + __left_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        strncpy(buf, " complex", n);
-        return buf + n;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __imaginary
-    : public __node
-{
-    static const size_t n = sizeof(" imaginary") - 1;
-public:
-
-    explicit __imaginary(__node* type)
-    {
-        __left_ = type;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(n + __left_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        strncpy(buf, " imaginary", n);
-        return buf + n;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __pack_expansion
-    : public __node
-{
-public:
-
-    explicit __pack_expansion(__node* type)
-    {
-        __left_ = type;
-    }
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t len = __left_->list_len();
-            size_t off = 0;
-            if (len != 0)
-            {
-                if (__left_->is_sub() || len == 1)
-                    off = __left_->size();
-                else
-                {
-                    __node* top = __left_;
-                    __node* bottom = top;
-                    while (!bottom->__left_->is_sub())
-                        bottom = bottom->__left_;
-                    __node* sub = bottom->__left_;
-                    __node* i = sub->__left_;
-                    bool first = true;
-                    top->reset_cached_size();
-                    while (i)
-                    {
-                        if (!first)
-                            off += 2;
-                        bottom->__left_ = i->__left_;
-                        off += top->size();
-                        top->reset_cached_size();
-                        i = i->__right_;
-                        first = false;
-                    }
-                    bottom->__left_ = sub;
-                }
-            }
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        size_t len = __left_->list_len();
-        if (len != 0)
-        {
-            if (__left_->is_sub() || len == 1)
-                buf = __left_->get_demangled_name(buf);
-            else
-            {
-                __node* top = __left_;
-                __node* bottom = top;
-                while (!bottom->__left_->is_sub())
-                    bottom = bottom->__left_;
-                __node* sub = bottom->__left_;
-                __node* i = sub->__left_;
-                bool first = true;
-                top->reset_cached_size();
-                while (i)
-                {
-                    if (!first)
-                    {
-                        *buf++ = ',';
-                        *buf++ = ' ';
-                    }
-                    bottom->__left_ = i->__left_;
-                    buf = top->get_demangled_name(buf);
-                    top->reset_cached_size();
-                    i = i->__right_;
-                    first = false;
-                }
-                bottom->__left_ = sub;
-            }
-        }
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __void
-    : public __node
-{
-    static const size_t n = sizeof("void") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "void", n);
-        return buf + n;
-    }
-};
-
-class __wchar_t
-    : public __node
-{
-    static const size_t n = sizeof("wchar_t") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "wchar_t", n);
-        return buf + n;
-    }
-};
-
-class __wchar_t_literal
-    : public __node
-{
-public:
-    explicit __wchar_t_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+9;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(wchar_t)", 9);
-        buf += 9;
-        strncpy(buf, __name_, __size_);
-        return buf + __size_;
-    }
-};
-
-class __bool
-    : public __node
-{
-    static const size_t n = sizeof("bool") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "bool", n);
-        return buf + n;
-    }
-};
-
-class __bool_literal
-    : public __node
-{
-public:
-    explicit __bool_literal(const char* __name, unsigned __size)
-    {
-        __name_ = __name;
-        __size_ = __size;
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, __name_, __size_);
-        return buf + __size_;
-    }
-};
-
-class __char
-    : public __node
-{
-    static const size_t n = sizeof("char") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "char", n);
-        return buf + n;
-    }
-};
-
-class __char_literal
-    : public __node
-{
-public:
-    explicit __char_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+6;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(char)", 6);
-        buf += 6;
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';  // strncpy(buf+6, "-", 1);
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        return buf;
-    }
-};
-
-class __signed_char
-    : public __node
-{
-    static const size_t n = sizeof("signed char") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "signed char", n);
-        return buf + n;
-    }
-};
-
-class __signed_char_literal
-    : public __node
-{
-public:
-    explicit __signed_char_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+13;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(signed char)", 13);
-        buf += 13;
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        return buf;
-    }
-};
-
-class __unsigned_char
-    : public __node
-{
-    static const size_t n = sizeof("unsigned char") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "unsigned char", n);
-        return buf + n;
-    }
-};
-
-class __unsigned_char_literal
-    : public __node
-{
-public:
-    explicit __unsigned_char_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+15;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(unsigned char)", 15);
-        buf += 15;
-        strncpy(buf, __name_, __size_);
-        return buf + __size_;
-    }
-};
-
-class __short
-    : public __node
-{
-    static const size_t n = sizeof("short") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "short", n);
-        return buf + n;
-    }
-};
-
-class __short_literal
-    : public __node
-{
-public:
-    explicit __short_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+7;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(short)", 7);
-        buf += 7;
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        return buf;
-    }
-};
-
-class __unsigned_short
-    : public __node
-{
-    static const size_t n = sizeof("unsigned short") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "unsigned short", n);
-        return buf + n;
-    }
-};
-
-class __unsigned_short_literal
-    : public __node
-{
-public:
-    explicit __unsigned_short_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+16;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(unsigned short)", 16);
-        buf += 16;
-        strncpy(buf, __name_, __size_);
-        return buf + __size_;
-    }
-};
-
-class __int
-    : public __node
-{
-    static const size_t n = sizeof("int") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        *buf++ = 'i';
-        *buf++ = 'n';
-        *buf++ = 't';
-        return buf;
-    }
-};
-
-class __int_literal
-    : public __node
-{
-public:
-    explicit __int_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        return buf;
-    }
-};
-
-class __unsigned_int
-    : public __node
-{
-    static const size_t n = sizeof("unsigned int") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "unsigned int", n);
-        return buf + n;
-    }
-};
-
-class __unsigned_int_literal
-    : public __node
-{
-public:
-    explicit __unsigned_int_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+1;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, __name_, __size_);
-        buf += __size_;
-        *buf++ = 'u';
-        return buf;
-    }
-};
-
-class __long
-    : public __node
-{
-    static const size_t n = sizeof("long") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "long", n);
-        return buf + n;
-    }
-};
-
-class __long_literal
-    : public __node
-{
-public:
-    explicit __long_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+1;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';  // strncpy(buf, "-", 1);
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        *buf++ = 'l';
-        return buf;
-    }
-};
-
-class __unsigned_long
-    : public __node
-{
-    static const size_t n = sizeof("unsigned long") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "unsigned long", n);
-        return buf + n;
-    }
-};
-
-class __unsigned_long_literal
-    : public __node
-{
-public:
-    explicit __unsigned_long_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+2;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, __name_, __size_);
-        buf += __size_;
-        *buf++ = 'u';
-        *buf++ = 'l';
-        return buf;
-    }
-};
-
-class __long_long
-    : public __node
-{
-    static const size_t n = sizeof("long long") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "long long", n);
-        return buf + n;
-    }
-};
-
-class __long_long_literal
-    : public __node
-{
-public:
-    explicit __long_long_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+2;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        *buf++ = 'l';
-        *buf++ = 'l';
-        return buf;
-    }
-};
-
-class __unsigned_long_long
-    : public __node
-{
-    static const size_t n = sizeof("unsigned long long") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "unsigned long long", n);
-        return buf + n;
-    }
-};
-
-class __unsigned_long_long_literal
-    : public __node
-{
-public:
-    explicit __unsigned_long_long_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+3;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, __name_, __size_);
-        buf += __size_;
-        *buf++ = 'u';
-        *buf++ = 'l';
-        *buf++ = 'l';
-        return buf;
-    }
-};
-
-class __signed_int128
-    : public __node
-{
-    static const size_t n = sizeof("__int128") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "__int128", n);
-        return buf + n;
-    }
-};
-
-class __int128_literal
-    : public __node
-{
-public:
-    explicit __int128_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+10;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(__int128)", 10);
-        buf += 10;
-        if (*__name_ == 'n')
-        {
-            *buf++ = '-';
-            strncpy(buf, __name_+1, __size_-1);
-            buf += __size_ - 1;
-        }
-        else
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        return buf;
-    }
-};
-
-class __unsigned_int128
-    : public __node
-{
-    static const size_t n = sizeof("unsigned __int128") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "unsigned __int128", n);
-        return buf + n;
-    }
-};
-
-class __unsigned_int128_literal
-    : public __node
-{
-public:
-    explicit __unsigned_int128_literal(const char* __first, const char* __last)
-    {
-        __name_ = __first;
-        __size_ = static_cast<size_t>(__last - __first);
-    }
-
-    virtual size_t first_size() const
-    {
-        return __size_+19;
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "(unsigned __int128)", 19);
-        buf += 19;
-        strncpy(buf, __name_, __size_);
-        return buf + __size_;
-    }
-};
-
-class __float_literal
-    : public __node
-{
-public:
-    explicit __float_literal(float value)
-    {
-        __value_ = value;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            char num[20] = {0};
-            float v = static_cast<float>(__value_);
-            const_cast<long&>(__cached_size_) = sprintf(num, "%a", v)+1;
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        char num[20] = {0};
-        float v = static_cast<float>(__value_);
-        int n = sprintf(num, "%a", v);
-        strncpy(buf, num, static_cast<size_t>(n));
-        buf += n;
-        *buf++ = 'f';
-        return buf;
-    }
-};
-
-class __float
-    : public __node
-{
-    static const size_t n = sizeof("float") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "float", n);
-        return buf + n;
-    }
-};
-
-class __double_literal
-    : public __node
-{
-public:
-    explicit __double_literal(double value)
-    {
-        __value_ = value;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            char num[30] = {0};
-            double v = static_cast<double>(__value_);
-            const_cast<long&>(__cached_size_) = sprintf(num, "%a", v);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        char num[30] = {0};
-        double v = static_cast<double>(__value_);
-        int n = sprintf(num, "%a", v);
-        strncpy(buf, num, static_cast<size_t>(n));
-        return buf + n;
-    }
-};
-
-class __double
-    : public __node
-{
-    static const size_t n = sizeof("double") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "double", n);
-        return buf + n;
-    }
-};
-
-class __long_double
-    : public __node
-{
-    static const size_t n = sizeof("long double") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "long double", n);
-        return buf + n;
-    }
-};
-
-class __float128
-    : public __node
-{
-    static const size_t n = sizeof("__float128") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "__float128", n);
-        return buf + n;
-    }
-};
-
-class __ellipsis
-    : public __node
-{
-    static const size_t n = sizeof("...") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        *buf++ = '.';
-        *buf++ = '.';
-        *buf++ = '.';
-        return buf;
-    }
-};
-
-class __decimal64
-    : public __node
-{
-    static const size_t n = sizeof("decimal64") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "decimal64", n);
-        return buf + n;
-    }
-};
-
-class __decimal128
-    : public __node
-{
-    static const size_t n = sizeof("decimal128") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "decimal128", n);
-        return buf + n;
-    }
-};
-
-class __decimal32
-    : public __node
-{
-    static const size_t n = sizeof("decimal32") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "decimal32", n);
-        return buf + n;
-    }
-};
-
-class __decimal16
-    : public __node
-{
-    static const size_t n = sizeof("decimal16") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "decimal16", n);
-        return buf + n;
-    }
-};
-
-class __d_char32_t
-    : public __node
-{
-    static const size_t n = sizeof("char32_t") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "char32_t", n);
-        return buf + n;
-    }
-};
-
-class __d_char16_t
-    : public __node
-{
-    static const size_t n = sizeof("char16_t") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "char16_t", n);
-        return buf + n;
-    }
-};
-
-class __auto
-    : public __node
-{
-    static const size_t n = sizeof("auto") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "auto", n);
-        return buf + n;
-    }
-};
-
-class __nullptr_t
-    : public __node
-{
-    static const size_t n = sizeof("std::nullptr_t") - 1;
-public:
-
-    virtual size_t first_size() const {return n;}
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "std::nullptr_t", n);
-        return buf + n;
-    }
-};
-
-class __array
-    : public __node
-{
-public:
-
-    explicit __array(__node* type)
-    {
-        __left_ = type;
-    }
-
-    __array(__node* type, size_t dim)
-    {
-        __left_ = type;
-        __size_ = dim;
-    }
-
-    __array(__node* type, __node* dim)
-    {
-        __left_ = type;
-        __right_ = dim;
-    }
-
-    virtual size_t size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t r = __left_->size() + 3;
-            if (__right_ != 0)
-                r += __right_->size();
-            else if (__size_ != 0)
-                r += static_cast<size_t>(snprintf(0, 0, "%ld", __size_));
-            const_cast<long&>(__cached_size_) = static_cast<long>(r);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual char* get_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = ' ';
-        *buf++ = '[';
-        if (__right_ != 0)
-            buf = __right_->get_demangled_name(buf);
-        else if (__size_ != 0)
-        {
-            int rs = sprintf(buf, "%ld", __size_);
-            buf += rs;
-        }
-        *buf++ = ']';
-        return buf;
-    }
-
-    virtual size_t first_size() const
-    {
-        return __left_->first_size();
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return __left_->first_demangled_name(buf);
-    }
-
-    virtual size_t second_size() const
-    {
-        size_t r = 2 + __left_->second_size();
-        if (!__left_->is_array())
-            ++r;
-        if (__right_ != 0)
-            r += __right_->size();
-        else if (__size_ != 0)
-            r += static_cast<size_t>(snprintf(0, 0, "%ld", __size_));
-        return r;
-    }
-
-    virtual char* second_demangled_name(char* buf) const
-    {
-        *buf++ = ' ';
-        *buf++ = '[';
-        if (__right_ != 0)
-            buf = __right_->get_demangled_name(buf);
-        else if (__size_ != 0)
-        {
-            int off = sprintf(buf, "%ld", __size_);
-            buf += off;
-        }
-        char* t = buf;
-        buf = __left_->second_demangled_name(buf);
-        *t = ']';
-        if (buf == t)
-            ++buf;
-        return buf;
-    }
-    virtual bool is_array() const
-    {
-        return true;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-class __pointer_to_member_type
-    : public __node
-{
-public:
-
-    __pointer_to_member_type(__node* class_type, __node* member_type)
-    {
-        __left_ = class_type;
-        __right_ = member_type;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() + 3
-                                                                + __right_->first_size()
-                                                                + __right_->second_size());
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __right_->first_demangled_name(buf);
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = ':';
-        *buf++ = ':';
-        *buf++ = '*';
-        return __right_->second_demangled_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool is_reference_or_pointer_to_function_or_array() const
-    {
-        return __right_->is_function();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-               __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __decltype_node
-    : public __node
-{
-public:
-
-    explicit __decltype_node(__node* expr)
-    {
-        __right_ = expr;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(10 + __right_->size());
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "decltype(", 9);
-        buf += 9;
-        buf = __right_->get_demangled_name(buf);
-        *buf++ = ')';
-        return buf;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __nested_delimeter
-    : public __node
-{
-public:
-
-    explicit __nested_delimeter(__node* prev, __node* arg)
-    {
-        __left_ = prev;
-        __right_ = arg;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__left_->size() +
-                                                                  __right_->size() + 2);
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = ':';
-        *buf++ = ':';
-        return __right_->get_demangled_name(buf);
-    }
-
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        return __right_->ends_with_template(parsing);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __right_->is_ctor_dtor_conv();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end) &&
-               __right_->fix_forward_references(t_begin, t_end);
-    }
-    virtual __node* extract_cv(__node*&) const
-    {
-        return __right_->extract_cv(const_cast<__node*&>(__right_));
-    }
-};
-
-class __unresolved_name
-    : public __node
-{
-public:
-
-    __unresolved_name(__node* prev, __node* arg)
-    {
-        __left_ = prev;
-        __right_ = arg;
-    }
-
-    __unresolved_name(bool global, __node* prev, __node* arg)
-    {
-        __size_ = global;
-        __left_ = prev;
-        __right_ = arg;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>((__left_ ?
-                                                     __left_->size() + 2 : 0) +
-                                                     __right_->size() + __size_ * 2);
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__size_)
-        {
-            *buf++ = ':';
-            *buf++ = ':';
-        }
-        if (__left_)
-        {
-            buf = __left_->get_demangled_name(buf);
-            *buf++ = ':';
-            *buf++ = ':';
-        }
-        return __right_->get_demangled_name(buf);
-    }
-
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        return __right_->ends_with_template(parsing);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return __right_->is_ctor_dtor_conv();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = __left_->fix_forward_references(t_begin, t_end);
-        return r && __right_->fix_forward_references(t_begin, t_end);
-    }
-    virtual __node* extract_cv(__node*&) const
-    {
-        return __right_->extract_cv(const_cast<__node*&>(__right_));
-    }
-};
-
-class __string_literal
-    : public __node
-{
-public:
-
-    virtual size_t first_size() const
-    {
-        return 14;
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        strncpy(buf, "string literal", 14);
-        return buf + 14;
-    }
-};
-
-class __constructor
-    : public __node
-{
-public:
-
-    explicit __constructor(__node* name)
-    {
-        __right_ = name;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__right_->base_size());
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        return __right_->get_base_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool ends_with_template(bool parsing = false) const
-    {
-        return __right_->ends_with_template(parsing);
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return true;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __destructor
-    : public __node
-{
-public:
-
-    explicit __destructor(__node* name)
-    {
-        __right_ = name;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-            const_cast<long&>(__cached_size_) = static_cast<long>(__right_->base_size() + 1);
-        return static_cast<size_t>(__cached_size_);
-    }
-
-    virtual char* first_demangled_name(char* buf) const
-    {
-        *buf++ = '~';
-        return __right_->get_base_name(buf);
-    }
-    virtual __node* base_name() const
-    {
-        return __right_->base_name();
-    }
-    virtual bool is_ctor_dtor_conv() const
-    {
-        return true;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __right_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __dot_suffix
-    : public __node
-{
-public:
-    __dot_suffix(__node* name, const char* suffix, size_t sz)
-    {
-        __left_ = name;
-        __name_ = suffix;
-        __size_ = sz;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off = __left_->size();
-            off += __size_ + 3;
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        buf = __left_->get_demangled_name(buf);
-        *buf++ = ' ';
-        *buf++ = '(';
-        strncpy(buf, __name_, __size_);
-        buf += __size_;
-        *buf++ = ')';
-        return buf;
-    }
-    virtual __node* base_name() const
-    {
-        return __left_->base_name();
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        return __left_->fix_forward_references(t_begin, t_end);
-    }
-};
-
-class __vector_type
-    : public __node
-{
-public:
-    __vector_type(__node* type, const char* num, size_t sz)
-    {
-        __left_ = type;
-        __name_ = num;
-        __size_ = sz;
-    }
-
-    __vector_type(__node* type, __node* num)
-    {
-        __left_ = type;
-        __right_ = num;
-    }
-
-    virtual size_t first_size() const
-    {
-        if (__cached_size_ == -1)
-        {
-            size_t off = 5;
-            if (__left_)
-                off = __left_->size();
-            off += 9;
-            if (__right_)
-                off += __right_->size();
-            else if (__size_ > 0)
-                off += __size_;
-            const_cast<long&>(__cached_size_) = static_cast<long>(off);
-        }
-        return static_cast<size_t>(__cached_size_);
-    }
-    virtual char* first_demangled_name(char* buf) const
-    {
-        if (__left_)
-            buf = __left_->get_demangled_name(buf);
-        else
-        {
-            strncpy(buf, "pixel", 5);
-            buf += 5;
-        }
-        strncpy(buf, " vector[", 8);
-        buf += 8;
-        if (__right_)
-            buf = __right_->get_demangled_name(buf);
-        else if (__size_ > 0)
-        {
-            strncpy(buf, __name_, __size_);
-            buf += __size_;
-        }
-        *buf++ = ']';
-        return buf;
-    }
-    virtual __node* base_name() const
-    {
-        if (__left_)
-            return __left_->base_name();
-        return __left_;
-    }
-    virtual bool fix_forward_references(__node** t_begin, __node** t_end)
-    {
-        bool r = true;
-        if (__left_)
-            r = __left_->fix_forward_references(t_begin, t_end);
-        if (__right_)
-            r = r && __right_->fix_forward_references(t_begin, t_end);
-        return r;
-    }
-};
-
-
-enum {invalid_args = -3, invalid_mangled_name, memory_alloc_failure, success,
-      not_yet_implemented};
-
-__demangle_tree::__demangle_tree(const char* mangled_name, char* buf, size_t bs)
-    : __mangled_name_begin_(0), __mangled_name_end_(0),
-      __status_(invalid_mangled_name), __root_(0),
-      __node_begin_(0), __node_end_(0), __node_cap_(0),
-      __sub_begin_(0), __sub_end_(0), __sub_cap_(0),
-      __t_begin_(0), __t_end_(0), __t_cap_(0),
-      __tag_templates_(true),
-      __fix_forward_references_(false)
-{
-    size_t n = strlen(mangled_name);
-    size_t ms = n + 2*n*sizeof(__node) + 2*n*sizeof(__node*);
-    char* m;
-    if (ms <= bs)
-    {
-        m = buf;
-        __owns_buf_ = false;
-    }
-    else
-    {
-        m = static_cast<char*>(malloc(ms));
-        __owns_buf_ = true;
-    }
-    if (m == NULL)
-    {
-        __status_ = memory_alloc_failure;
-        return;
-    }
-    __node_begin_ = __node_end_ = (__node*)(m);
-    __node_cap_ = __node_begin_ + 2*n;
-    __sub_begin_ =  __sub_end_ = (__node**)(__node_cap_);
-    __sub_cap_ = __sub_begin_ + n;
-    __t_begin_ =  __t_end_ = (__node**)(__sub_cap_);
-    __t_cap_ = __t_begin_ + n;
-    __mangled_name_begin_ = (const char*)(__t_cap_);
-    __mangled_name_end_ = __mangled_name_begin_ + n;
-    strncpy(const_cast<char*>(__mangled_name_begin_), mangled_name, n);
-}
-
-__demangle_tree::~__demangle_tree()
-{
-    if (__owns_buf_)
-        free(__node_begin_);
-}
-
-__demangle_tree::__demangle_tree(__demangle_tree& t)
-    : __mangled_name_begin_(t.__mangled_name_begin_),
-      __mangled_name_end_(t.__mangled_name_end_),
-      __status_(t.__status_), __root_(t.__root_),
-      __node_begin_(t.__node_begin_), __node_end_(t.__node_end_),
-      __node_cap_(t.__node_cap_),
-      __sub_begin_(t.__sub_begin_), __sub_end_(t.__sub_end_),
-      __sub_cap_(t.__sub_cap_),
-      __t_begin_(t.__t_begin_), __t_end_(t.__t_end_),
-      __t_cap_(t.__t_cap_),
-      __tag_templates_(t.__tag_templates_),
-      __fix_forward_references_(t.__fix_forward_references_),
-      __owns_buf_(t.__owns_buf_)
-{
-    t.__mangled_name_begin_ = 0;
-    t.__mangled_name_end_ = 0;
-    t.__status_ = invalid_mangled_name;
-    t.__root_ = 0;
-    t.__node_begin_ = t.__node_end_ = t.__node_cap_ = 0;
-    t.__sub_begin_ = t.__sub_end_ = t.__sub_cap_ = 0;
-    t.__t_begin_ = t.__t_end_ = t.__t_cap_ = 0;
-    t.__owns_buf_ = false;
-}
-
-__demangle_tree::__demangle_tree(__demangle_tree_rv rv)
-    : __mangled_name_begin_(rv.ptr_->__mangled_name_begin_),
-      __mangled_name_end_(rv.ptr_->__mangled_name_end_),
-      __status_(rv.ptr_->__status_), __root_(rv.ptr_->__root_),
-      __node_begin_(rv.ptr_->__node_begin_), __node_end_(rv.ptr_->__node_end_),
-      __node_cap_(rv.ptr_->__node_cap_),
-      __sub_begin_(rv.ptr_->__sub_begin_), __sub_end_(rv.ptr_->__sub_end_),
-      __sub_cap_(rv.ptr_->__sub_cap_),
-      __t_begin_(rv.ptr_->__t_begin_), __t_end_(rv.ptr_->__t_end_),
-      __t_cap_(rv.ptr_->__t_cap_),
-      __tag_templates_(rv.ptr_->__tag_templates_),
-      __fix_forward_references_(rv.ptr_->__fix_forward_references_),
-      __owns_buf_(rv.ptr_->__owns_buf_)
-{
-    rv.ptr_->__mangled_name_begin_ = 0;
-    rv.ptr_->__mangled_name_end_ = 0;
-    rv.ptr_->__status_ = invalid_mangled_name;
-    rv.ptr_->__root_ = 0;
-    rv.ptr_->__node_begin_ = rv.ptr_->__node_end_ = rv.ptr_->__node_cap_ = 0;
-    rv.ptr_->__sub_begin_ = rv.ptr_->__sub_end_ = rv.ptr_->__sub_cap_ = 0;
-    rv.ptr_->__t_begin_ = rv.ptr_->__t_end_ = rv.ptr_->__t_cap_ = 0;
-    rv.ptr_->__owns_buf_ = false;
-}
-
-int
-__demangle_tree::__status() const
-{
-    return __status_;
-}
-
-size_t
-__demangle_tree::size() const
-{
-    return __status_ == success ? __root_->size() : 0;
-}
-
-char*
-__demangle_tree::__get_demangled_name(char* buf) const
-{
-    if (__status_ == success)
-        return __root_->get_demangled_name(buf);
-    return 0;
-}
-
-template <class _Tp>
-bool
-__demangle_tree::__make()
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp();
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-template <class _Tp, class _A0>
-bool
-__demangle_tree::__make(_A0 __a0)
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp(__a0);
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-template <class _Tp, class _A0, class _A1>
-bool
-__demangle_tree::__make(_A0 __a0, _A1 __a1)
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp(__a0, __a1);
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-template <class _Tp, class _A0, class _A1, class _A2>
-bool
-__demangle_tree::__make(_A0 __a0, _A1 __a1, _A2 __a2)
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp(__a0, __a1, __a2);
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-template <class _Tp, class _A0, class _A1, class _A2, class _A3>
-bool
-__demangle_tree::__make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3)
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp(__a0, __a1, __a2, __a3);
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4>
-bool
-__demangle_tree::__make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4)
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp(__a0, __a1, __a2, __a3, __a4);
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4,
-                     class _A5>
-bool
-__demangle_tree::__make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4,
-                        _A5 __a5)
-{
-    if (__node_end_ < __node_cap_)
-    {
-        ::new (__node_end_) _Tp(__a0, __a1, __a2, __a3, __a4, __a5);
-        __root_ = __node_end_;
-        ++__node_end_;
-        return true;
-    }
-    __status_ = memory_alloc_failure;
-    return false;
-}
-
-// <CV-qualifiers> ::= [r] [V] [K]  # restrict (C99), volatile, const
-//                         [R | O]  # & or &&
-
-const char*
-__demangle_tree::__parse_cv_qualifiers(const char* first, const char* last,
-                                       unsigned& cv, bool look_for_ref_quals)
-{
-    if (look_for_ref_quals)
-    {
-        for (; first != last; ++first)
-        {
-            switch (*first)
-            {
-            case 'r':
-                cv |= 4;
-                break;
-            case 'V':
-                cv |= 2;
-                break;
-            case 'K':
-                cv |= 1;
-                break;
-            case 'R':
-                cv |= 8;
-                break;
-            case 'O':
-                cv |= 16;
-                break;
-            default:
-                return first;
-            }
-        }
-    }
-    else
-    {
-        for (; first != last; ++first)
-        {
-            switch (*first)
-            {
-            case 'r':
-                cv |= 4;
-                break;
-            case 'V':
-                cv |= 2;
-                break;
-            case 'K':
-                cv |= 1;
-                break;
-            default:
-                return first;
-            }
-        }
-    }
-    return first;
-}
-
-// <builtin-type> ::= v    # void
-//                ::= w    # wchar_t
-//                ::= b    # bool
-//                ::= c    # char
-//                ::= a    # signed char
-//                ::= h    # unsigned char
-//                ::= s    # short
-//                ::= t    # unsigned short
-//                ::= i    # int
-//                ::= j    # unsigned int
-//                ::= l    # long
-//                ::= m    # unsigned long
-//                ::= x    # long long, __int64
-//                ::= y    # unsigned long long, __int64
-//                ::= n    # __int128
-//                ::= o    # unsigned __int128
-//                ::= f    # float
-//                ::= d    # double
-//                ::= e    # long double, __float80
-//                ::= g    # __float128
-//                ::= z    # ellipsis
-//                ::= Dd   # IEEE 754r decimal floating point (64 bits)
-//                ::= De   # IEEE 754r decimal floating point (128 bits)
-//                ::= Df   # IEEE 754r decimal floating point (32 bits)
-//                ::= Dh   # IEEE 754r half-precision floating point (16 bits)
-//                ::= Di   # char32_t
-//                ::= Ds   # char16_t
-//                ::= Da   # auto (in dependent new-expressions)
-//                ::= Dn   # std::nullptr_t (i.e., decltype(nullptr))
-//                ::= u <source-name>    # vendor extended type
-
-const char*
-__demangle_tree::__parse_builtin_type(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        switch (*first)
-        {
-        case 'v':
-            if (__make<__void>())
-                ++first;
-            break;
-        case 'w':
-            if (__make<__wchar_t>())
-                ++first;
-            break;
-        case 'b':
-            if (__make<__bool>())
-                ++first;
-            break;
-        case 'c':
-            if (__make<__char>())
-                ++first;
-            break;
-        case 'a':
-            if (__make<__signed_char>())
-                ++first;
-            break;
-        case 'h':
-            if (__make<__unsigned_char>())
-                ++first;
-            break;
-        case 's':
-            if (__make<__short>())
-                ++first;
-            break;
-        case 't':
-            if (__make<__unsigned_short>())
-                ++first;
-            break;
-        case 'i':
-            if (__make<__int>())
-                ++first;
-            break;
-        case 'j':
-            if (__make<__unsigned_int>())
-                ++first;
-            break;
-        case 'l':
-            if (__make<__long>())
-                ++first;
-            break;
-        case 'm':
-            if (__make<__unsigned_long>())
-                ++first;
-            break;
-        case 'x':
-            if (__make<__long_long>())
-                ++first;
-            break;
-        case 'y':
-            if (__make<__unsigned_long_long>())
-                ++first;
-            break;
-        case 'n':
-            if (__make<__signed_int128>())
-                ++first;
-            break;
-        case 'o':
-            if (__make<__unsigned_int128>())
-                ++first;
-            break;
-        case 'f':
-            if (__make<__float>())
-                ++first;
-            break;
-        case 'd':
-            if (__make<__double>())
-                ++first;
-            break;
-        case 'e':
-            if (__make<__long_double>())
-                ++first;
-            break;
-        case 'g':
-            if (__make<__float128>())
-                ++first;
-            break;
-        case 'z':
-            if (__make<__ellipsis>())
-                ++first;
-            break;
-        case 'D':
-            if (first+1 != last)
-            {
-                switch (first[1])
-                {
-                case 'd':
-                    if (__make<__decimal64>())
-                        first += 2;
-                    break;
-                case 'e':
-                    if (__make<__decimal128>())
-                        first += 2;
-                    break;
-                case 'f':
-                    if (__make<__decimal32>())
-                        first += 2;
-                    break;
-                case 'h':
-                    if (__make<__decimal16>())
-                        first += 2;
-                    break;
-                case 'i':
-                    if (__make<__d_char32_t>())
-                        first += 2;
-                    break;
-                case 's':
-                    if (__make<__d_char16_t>())
-                        first += 2;
-                    break;
-                case 'a':
-                    if (__make<__auto>())
-                        first += 2;
-                    break;
-                case 'n':
-                    if (__make<__nullptr_t>())
-                        first += 2;
-                    break;
-                }
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <bare-function-type> ::= <signature type>+
-//                      # types are possible return type, then parameter types
-
-const char*
-__demangle_tree::__parse_bare_function_type(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        bool prev_tag_templates = __tag_templates_;
-        __tag_templates_ = false;
-        const char* t = __parse_type(first, last);
-        if (t != first && __make<__list>(__root_))
-        {
-            const char* t0 = t;
-            __node* head = __root_;
-            __node* prev = head;
-            while (true)
-            {
-                t = __parse_type(t0, last);
-                if (t != t0)
-                {
-                    if (__make<__list>(__root_))
-                    {
-                        t0 = t;
-                        prev->__right_ = __root_;
-                        __root_->__size_ = prev->__size_ + 1;
-                        prev = __root_;
-                    }
-                    else
-                        break;
-                }
-                else
-                {
-                    first = t;
-                    __root_ = head;
-                    break;
-                }
-            }
-        }
-        __tag_templates_ = prev_tag_templates;
-    }
-    return first;
-}
-
-// <function-type> ::= F [Y] <bare-function-type> E
-
-const char*
-__demangle_tree::__parse_function_type(const char* first, const char* last)
-{
-    if (first != last && *first == 'F')
-    {
-        const char* t = first+1;
-        if (t != last)
-        {
-            bool externC = false;
-            if (*t == 'Y')
-            {
-                externC = true;
-                if (++t == last)
-                    return first;
-            }
-            const char* t1 = __parse_type(t, last);
-            if (t1 != t)
-            {
-                __node* ret = __root_;
-                t = t1;
-                t1 = __parse_bare_function_type(t, last);
-                if (t1 != t && t1 != last && *t1 == 'E')
-                {
-                    if (dynamic_cast<__void*>(__root_->__left_) != NULL)
-                        __root_->__left_ = NULL;
-                    if (__make<__function_signature>(ret, __root_))
-                    {
-                        if (__make<__function>((__node*)0, __root_))
-                            first = t1+1;
-                    }
-                }
-            }
-        }
-    }
-    return first;
-}
-
-const char*
-__demangle_tree::__parse_hex_number(const char* first, const char* last, unsigned long long& n)
-{
-    const char* t = first;
-    for (; t != last && isxdigit(*t); ++t)
-    {
-        if (t == first)
-            n = 0;
-        if (isdigit(*t))
-            n = n * 16 + static_cast<unsigned long long>(*t - '0');
-        else if (isupper(*t))
-            n = n * 16 + static_cast<unsigned long long>(*t - 'A') + 10;
-        else
-            n = n * 16 + static_cast<unsigned long long>(*t - 'a') + 10;
-    }
-    first = t;
-    return first;
-}
-
-// <expr-primary> ::= L <type> <value number> E                          # integer literal
-//                ::= L <type> <value float> E                           # floating literal
-//                ::= L <string type> E                                  # string literal
-//                ::= L <nullptr type> E                                 # nullptr literal (i.e., "LDnE")
-//                ::= L <type> <real-part float> _ <imag-part float> E   # complex floating point literal (C 2000)
-//                ::= L <mangled-name> E                                 # external name
-
-const char*
-__demangle_tree::__parse_expr_primary(const char* first, const char* last)
-{
-    if (last - first >= 4 && *first == 'L')
-    {
-        switch (first[1])
-        {
-        case 'w':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__wchar_t_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'b':
-            if (first[3] == 'E')
-            {
-                switch (first[2])
-                {
-                case '0':
-                    if (__make<__bool_literal>("false", 5u))
-                        first += 4;
-                    break;
-                case '1':
-                    if (__make<__bool_literal>("true", 4u))
-                        first += 4;
-                    break;
-                }
-            }
-            break;
-        case 'c':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__char_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'a':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__signed_char_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'h':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__unsigned_char_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 's':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__short_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 't':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__unsigned_short_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'i':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__int_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'j':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__unsigned_int_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'l':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__long_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'm':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__unsigned_long_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'x':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__long_long_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'y':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__unsigned_long_long_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'n':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__int128_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'o':
-            {
-                const char* t = __parse_number(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__unsigned_int128_literal>(first+2, t))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'f':
-            {
-                if (last - (first+2) <= 8)
-                    return first;
-                unsigned long long j;
-                const char* t = __parse_hex_number(first+2, first+10, j);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    unsigned i = static_cast<unsigned>(j);
-                    float value = *(float*)&i;
-                    if (__make<__float_literal>(value))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'd':
-            {
-                if (last - (first+2) <= 16)
-                    return first;
-                unsigned long long j;
-                const char* t = __parse_hex_number(first+2, first+18, j);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    double value = *(double*)&j;
-                    if (__make<__double_literal>(value))
-                        first = t+1;
-                }
-            }
-            break;
-        case 'e':
-            break;
-        case '_':
-            if (first[2] == 'Z')
-            {
-                const char* t = __parse_encoding(first+3, last);
-                if (t != first+3 && t != last && *t == 'E')
-                    first = t+1;
-            }
-            break;
-        case 'T':
-            // Invalid mangled name per
-            //   http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html
-            break;
-        default:
-            {
-                // might be named type
-                const char* t = __parse_type(first+1, last);
-                if (t != first+1 && t != last)
-                {
-                    if (*t != 'E')
-                    {
-                        const char* n = t;
-                        for (; n != last && isdigit(*n); ++n)
-                            ;
-                        if (n != t && n != last && *n == 'E')
-                        {
-                            if (__make<__cast_literal>(__root_, t, n))
-                            {
-                                first = n+1;
-                                break;
-                            }
-                        }
-                    }
-                    else
-                    {
-                        first = t+1;
-                        break;
-                    }
-                }
-            }
-//            assert(!"case in __parse_expr_primary not implemented");
-            __status_ = not_yet_implemented;
-        }
-    }
-    return first;
-}
-
-// <unnamed-type-name> ::= Ut [ <nonnegative number> ] _
-//                     ::= <closure-type-name>
-// 
-// <closure-type-name> ::= Ul <lambda-sig> E [ <nonnegative number> ] _ 
-// 
-// <lambda-sig> ::= <parameter type>+  # Parameter types or "v" if the lambda has no parameters
-
-const char*
-__demangle_tree::__parse_unnamed_type_name(const char* first, const char* last)
-{
-    if (last - first > 2 && first[0] == 'U')
-    {
-        char type = first[1];
-        switch (type)
-        {
-        case 't':
-        case 'l':
-            {
-            const char* t = first + 2;
-            __node* params = 0;
-            if (type == 'l')
-            {
-                if (*t == 'v')
-                {
-                    // void lambda
-                    ++t;
-                    if (t != last && *t == 'E')
-                        ++t;
-                    else
-                        return first;
-                }
-                else
-                {
-                    const char* t1 = __parse_type(t, last);
-                    if (t1 == t || !__make<__list>(__root_))
-                        return first;
-                    params = __root_;
-                    __node* prev = params;
-                    t = t1;
-                    while (true)
-                    {
-                        t1 = __parse_type(t, last);
-                        if (t1 == t)
-                            break;
-                        if (!__make<__list>(__root_))
-                            return first;
-                        t = t1;
-                        prev->__right_ = __root_;
-                        __root_->__size_ = prev->__size_ + 1;
-                        prev = __root_;
-                    }
-                    if (t == last || *t != 'E')
-                        return first;
-                    ++t;
-                }
-            }
-            const char* number_start = t;
-            const char* number_end = __parse_number(t, last);
-            if (number_end == last || *number_end != '_')
-                return first;
-            t = number_end + 1;
-            if (type == 'l')
-            {
-                if (!__make<___lambda_node>(params, number_start, static_cast<size_t>(number_end - number_start)))
-                    return first;
-            }
-            else
-            {
-                if (!__make<__unnamed>(number_start, static_cast<size_t>(number_end - number_start)))
-                    return first;
-            }
-            first = t;
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <ctor-dtor-name> ::= C1    # complete object constructor
-//                  ::= C2    # base object constructor
-//                  ::= C3    # complete object allocating constructor
-//                  ::= D0    # deleting destructor
-//                  ::= D1    # complete object destructor
-//                  ::= D2    # base object destructor
-
-const char*
-__demangle_tree::__parse_ctor_dtor_name(const char* first, const char* last)
-{
-    if (last-first >= 2 && __root_)
-    {
-        switch (first[0])
-        {
-        case 'C':
-            switch (first[1])
-            {
-            case '1':
-            case '2':
-            case '3':
-                if (__make<__constructor>(__root_->base_name()))
-                    first += 2;
-                break;
-            }
-            break;
-        case 'D':
-            switch (first[1])
-            {
-            case '0':
-            case '1':
-            case '2':
-                if (__make<__destructor>(__root_->base_name()))
-                    first += 2;
-                break;
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-const char*
-__demangle_tree::__parse_unscoped_template_name(const char* first, const char*)
-{
-//    assert(!"__parse_unscoped_template_name not implemented");
-    __status_ = not_yet_implemented;
-    return first;
-}
-
-// <discriminator> := _ <non-negative number>      # when number < 10
-//                 := __ <non-negative number> _   # when number >= 10
-//  extension      := decimal-digit+
-
-const char*
-__demangle_tree::__parse_discriminator(const char* first, const char* last)
-{
-    // parse but ignore discriminator
-    if (first != last)
-    {
-        if (*first == '_')
-        {
-            const char* t1 = first+1;
-            if (t1 != last)
-            {
-                if (isdigit(*t1))
-                    first = t1+1;
-                else if (*t1 == '_')
-                {
-                    for (++t1; t1 != last && isdigit(*t1); ++t1)
-                        ;
-                    if (t1 != last && *t1 == '_')
-                        first = t1 + 1;
-                }
-            }
-        }
-        else if (isdigit(*first))
-        {
-            const char* t1 = first+1;
-            for (; t1 != last && isdigit(*t1); ++t1)
-                ;
-            first = t1;
-        }
-    }
-    return first;
-}
-
-// <local-name> := Z <function encoding> E <entity name> [<discriminator>]
-//              := Z <function encoding> E s [<discriminator>]
-//              := Z <function encoding> Ed [ <parameter number> ] _ <entity name>
-
-const char*
-__demangle_tree::__parse_local_name(const char* first, const char* last)
-{
-    if (first != last && *first == 'Z')
-    {
-        const char* t = __parse_encoding(first+1, last);
-        if (t != first+1 && t != last && *t == 'E' && ++t != last)
-        {
-            __node* encoding = __root_;
-            switch (*t)
-            {
-            case 's':
-                {
-                    const char*t1 = __parse_discriminator(t+1, last);
-                    if (__make<__string_literal>())
-                    {
-                        if (__make<__nested_delimeter>(encoding, __root_))
-                            first = t1;
-                    }
-                }
-                break;
-            case 'd':
-//                assert(!"__parse_local_name d not implemented");
-                __status_ = not_yet_implemented;
-                break;
-            default:
-                {
-                    const char*t1 = __parse_name(t, last);
-                    if (t1 != t)
-                    {
-                        // parse but ignore discriminator
-                        t1 = __parse_discriminator(t1, last);
-                        if (__make<__nested_delimeter>(encoding, __root_))
-                            first = t1;
-                    }
-                }
-                break;
-            }
-        }
-    }
-    return first;
-}
-
-// <destructor-name> ::= <unresolved-type>                               # e.g., ~T or ~decltype(f())
-//                   ::= <simple-id>                                     # e.g., ~A<2*N>
-
-const char*
-__demangle_tree::__parse_destructor_name(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        const char* t = __parse_unresolved_type(first, last);
-        if (t == first)
-            t = __parse_simple_id(first, last);
-        if (t != first && __make<__destructor>(__root_))
-            first = t;
-    }
-    return first;
-}
-
-// <simple-id> ::= <source-name> [ <template-args> ]
-
-const char*
-__demangle_tree::__parse_simple_id(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        const char* t = __parse_source_name(first, last);
-        if (t != first)
-            first = __parse_template_args(t, last);
-        else
-            first = t;
-    }
-    return first;
-}
-
-// <base-unresolved-name> ::= <simple-id>                                # unresolved name
-//          extension     ::= <operator-name>                            # unresolved operator-function-id
-//          extension     ::= <operator-name> <template-args>            # unresolved operator template-id
-//                        ::= on <operator-name>                         # unresolved operator-function-id
-//                        ::= on <operator-name> <template-args>         # unresolved operator template-id
-//                        ::= dn <destructor-name>                       # destructor or pseudo-destructor;
-//                                                                         # e.g. ~X or ~X<N-1>
-
-const char*
-__demangle_tree::__parse_base_unresolved_name(const char* first, const char* last)
-{
-    if (last - first >= 2)
-    {
-        if ((first[0] == 'o' || first[0] == 'd') && first[1] == 'n')
-        {
-            if (first[0] == 'o')
-            {
-                const char* t = __parse_operator_name(first+2, last);
-                if (t != first+2)
-                    first = __parse_template_args(t, last);
-                else
-                    first = t;
-            }
-            else
-            {
-                const char* t = __parse_destructor_name(first+2, last);
-                if (t != first+2)
-                    first = t;
-            }
-        }
-        else
-        {
-            const char* t = __parse_simple_id(first, last);
-            if (t == first)
-            {
-                t = __parse_operator_name(first, last);
-                if (t != first)
-                    t = __parse_template_args(t, last);
-            }
-            if (t != first)
-                first = t;
-        }
-    }
-    return first;
-}
-
-// <unresolved-type> ::= <template-param>
-//                   ::= <decltype>
-//                   ::= <substitution>
-
-const char*
-__demangle_tree::__parse_unresolved_type(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        const char* t;
-        switch (*first)
-        {
-        case 'T':
-            t = __parse_template_param(first, last);
-            if (t != first)
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else 
-                {
-                    *__sub_end_++ = __root_;
-                    first = t;
-                }
-            }
-            break;
-        case 'D':
-            t = __parse_decltype(first, last);
-            if (t != first)
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else 
-                {
-                    *__sub_end_++ = __root_;
-                    first = t;
-                }
-            }
-            break;
-        case 'S':
-            t = __parse_substitution(first, last);
-            if (t != first)
-                first = t;
-            break;
-        }
-    }
-    return first;
-}
-
-// <unresolved-qualifier-level> ::= <source-name> [ <template-args> ]
-
-const char*
-__demangle_tree::__parse_unresolved_qualifier_level(const char* first, const char* last)
-{
-    if (first != last)
-    {
-            const char* t = __parse_source_name(first, last);
-            if (t != first)
-                first = __parse_template_args(t, last);
-    }
-    return first;
-}
-
-// <unresolved-name>
-//  extension        ::= srN <unresolved-type> [<template-args>] <unresolved-qualifier-level>* E <base-unresolved-name>
-//                   ::= [gs] <base-unresolved-name>                     # x or (with "gs") ::x
-//                   ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name>  
-//                                                                       # A::x, N::y, A<T>::z; "gs" means leading "::"
-//                   ::= sr <unresolved-type> <base-unresolved-name>     # T::x / decltype(p)::x
-//                                                                       # T::N::x /decltype(p)::N::x
-//  (ignored)        ::= srN <unresolved-type>  <unresolved-qualifier-level>+ E <base-unresolved-name>
-
-const char*
-__demangle_tree::__parse_unresolved_name(const char* first, const char* last)
-{
-    if (last - first > 2)
-    {
-        const char* t = first;
-        bool global = false;
-        if (t[0] == 'g' && t[1] == 's')
-        {
-            global = true;
-            t += 2;
-        }
-        const char* t2 = __parse_base_unresolved_name(t, last);
-        if (t2 != t)
-        {
-            if (__make<__unresolved_name>(global, (__node*)0, __root_))
-                first = t2;
-        }
-        else if (last - t > 2 && t[0] == 's' && t[1] == 'r')
-        {
-            if (!global && t[2] == 'N')
-            {
-                t2 = __parse_unresolved_type(t+3, last);
-                if (t2 != t+3 && t2 != last)
-                {
-                    t = __parse_template_args(t2, last);
-                    if (t == last)
-                        return first;
-                    __node* name = __root_;
-                    while (*t != 'E')
-                    {
-                        t2 = __parse_unresolved_qualifier_level(t, last);
-                        if (t2 == t || t2 == last)
-                            return first;
-                        if (!__make<__nested_delimeter>(name, __root_))
-                            return first;
-                        name = __root_;
-                        t = t2;
-                    }
-                    t2 = __parse_base_unresolved_name(++t, last);
-                    if (t2 != t && __make<__unresolved_name>(false, name, __root_))
-                        first = t2;
-                }
-            }
-            else
-            {
-                if (!global)
-                {
-                    t2 = __parse_unresolved_type(t+2, last);
-                    if (t2 != t+2)
-                    {
-                        t = t2;
-                        __node* name = __root_;
-                        t2 = __parse_base_unresolved_name(t, last);
-                        if (t2 != t && __make<__unresolved_name>(false, name, __root_))
-                            return t2;
-                        return first;
-                    }
-                }
-                t2 = __parse_unresolved_qualifier_level(t+2, last);
-                if (t2 != t+2 && t2 != last)
-                {
-                    __node* name = __root_;
-                    t = t2;
-                    while (*t != 'E')
-                    {
-                        t2 = __parse_unresolved_qualifier_level(t, last);
-                        if (t2 == t || t2 == last)
-                            return first;
-                        if (!__make<__nested_delimeter>(name, __root_))
-                            return first;
-                        name = __root_;
-                        t = t2;
-                    }
-                    t2 = __parse_base_unresolved_name(++t, last);
-                    if (t2 != t && __make<__unresolved_name>(global, name, __root_))
-                        first = t2;
-                }
-            }
-        }
-    }
-    return first;
-}
-
-// <function-param> ::= fp <top-level CV-qualifiers> _                                     # L == 0, first parameter
-//                  ::= fp <top-level CV-qualifiers> <parameter-2 non-negative number> _   # L == 0, second and later parameters
-//                  ::= fL <L-1 non-negative number> p <top-level CV-qualifiers> _         # L > 0, first parameter
-//                  ::= fL <L-1 non-negative number> p <top-level CV-qualifiers>
-
-const char*
-__demangle_tree::__parse_function_param(const char* first, const char* last)
-{
-    if (last - first >= 3 && *first == 'f')
-    {
-        if (first[1] == 'p')
-        {
-//            assert(!"__parse_function_param not implemented");
-            __status_ = not_yet_implemented;
-        }
-        else if (first[1] == 'L')
-        {
-//            assert(!"__parse_function_param not implemented");
-            __status_ = not_yet_implemented;
-        }
-    }
-    return first;
-}
-
-// at <type>                                            # alignof (a type)
-
-const char*
-__demangle_tree::__parse_alignof_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'a' && first[1] == 't')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__operator_alignof_expression>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// cc <type> <expression>                               # const_cast<type> (expression)
-
-const char*
-__demangle_tree::__parse_const_cast_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'c' && first[1] == 'c')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            __node* type = __root_;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__const_cast>(type, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// cl <expression>+ E                                   # call
-
-const char*
-__demangle_tree::__parse_call_expr(const char* first, const char* last)
-{
-    if (last - first >= 4 && first[0] == 'c' && first[1] == 'l')
-    {
-        const char* t = __parse_expression(first+2, last);
-        if (t != first+2)
-        {
-            if (t == last)
-                return first;
-            __node* name = __root_;
-            __node* args = 0;
-            __node* prev = 0;
-            while (*t != 'E')
-            {
-                const char* t1 = __parse_expression(t, last);
-                if (t1 == t || t1 == last)
-                    return first;
-                if (!__make<__list>(__root_))
-                    return first;
-                if (args == 0)
-                    args = __root_;
-                if (prev)
-                {
-                    prev->__right_ = __root_;
-                    __root_->__size_ = prev->__size_ + 1;
-                }
-                prev = __root_;
-                t = t1;
-            }
-            ++t;
-            if (__make<__call_expr>(name, args))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// cv <type> <expression>                               # conversion with one argument
-// cv <type> _ <expression>* E                          # conversion with a different number of arguments
-
-const char*
-__demangle_tree::__parse_conversion_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'c' && first[1] == 'v')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2 && t != last)
-        {
-            __node* type = __root_;
-            __node* args = 0;
-            if (*t != '_')
-            {
-                const char* t1 = __parse_expression(t, last);
-                if (t1 == t)
-                    return first;
-                args = __root_;
-                t = t1;
-            }
-            else
-            {
-                ++t;
-                if (t == last)
-                    return first;
-                __node* prev = 0;
-                while (*t != 'E')
-                {
-                    const char* t1 = __parse_expression(t, last);
-                    if (t1 == t || t1 == last)
-                        return first;
-                    if (!__make<__list>(__root_))
-                        return first;
-                    if (args == 0)
-                        args = __root_;
-                    if (prev)
-                    {
-                        prev->__right_ = __root_;
-                        __root_->__size_ = prev->__size_ + 1;
-                    }
-                    prev = __root_;
-                    t = t1;
-                }
-                ++t;
-            }
-            if (__make<__operator_cast>(type, args))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// [gs] da <expression>                                 # delete[] expression
-
-const char*
-__demangle_tree::__parse_delete_array_expr(const char* first, const char* last)
-{
-    if (last - first >= 4)
-    {
-        const char* t = first;
-        bool parsed_gs = false;
-        if (t[0] == 'g' && t[1] == 's')
-        {
-            t += 2;
-            parsed_gs = true;
-        }
-        if (t[0] == 'd' && t[1] == 'a')
-        {
-            t += 2;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__delete_array_expr>(parsed_gs, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// dc <type> <expression>                               # dynamic_cast<type> (expression)
-
-const char*
-__demangle_tree::__parse_dynamic_cast_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'd' && first[1] == 'c')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            __node* type = __root_;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__dynamic_cast>(type, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// [gs] dl <expression>                                 # delete expression
-
-const char*
-__demangle_tree::__parse_delete_expr(const char* first, const char* last)
-{
-    if (last - first >= 4)
-    {
-        const char* t = first;
-        bool parsed_gs = false;
-        if (t[0] == 'g' && t[1] == 's')
-        {
-            t += 2;
-            parsed_gs = true;
-        }
-        if (t[0] == 'd' && t[1] == 'l')
-        {
-            t += 2;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__delete_expr>(parsed_gs, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// ds <expression> <expression>                         # expr.*expr
-
-const char*
-__demangle_tree::__parse_dot_star_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'd' && first[1] == 's')
-    {
-        const char* t = __parse_expression(first+2, last);
-        if (t != first+2)
-        {
-            __node* expr = __root_;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__dot_star_expr>(expr, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// dt <expression> <unresolved-name>                    # expr.name
-
-const char*
-__demangle_tree::__parse_dot_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'd' && first[1] == 't')
-    {
-        const char* t = __parse_expression(first+2, last);
-        if (t != first+2)
-        {
-            __node* expr = __root_;
-            const char* t1 = __parse_unresolved_name(t, last);
-            if (t1 != t)
-            {
-                if (__make<__dot_expr>(expr, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// mm_ <expression>                                     # prefix --
-
-const char*
-__demangle_tree::__parse_decrement_expr(const char* first, const char* last)
-{
-    if (last - first > 3 && first[0] == 'm' && first[1] == 'm' && first[2] == '_')
-    {
-        const char* t = __parse_expression(first+3, last);
-        if (t != first+3)
-        {
-            if (__make<__operator_decrement>(true, __root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// pp_ <expression>                                     # prefix ++
-
-const char*
-__demangle_tree::__parse_increment_expr(const char* first, const char* last)
-{
-    if (last - first > 3 && first[0] == 'p' && first[1] == 'p' && first[2] == '_')
-    {
-        const char* t = __parse_expression(first+3, last);
-        if (t != first+3)
-        {
-            if (__make<__operator_increment>(true, __root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// [gs] nw <expression>* _ <type> E                     # new (expr-list) type
-// [gs] nw <expression>* _ <type> <initializer>         # new (expr-list) type (init)
-// [gs] na <expression>* _ <type> E                     # new[] (expr-list) type
-// [gs] na <expression>* _ <type> <initializer>         # new[] (expr-list) type (init)
-// <initializer> ::= pi <expression>* E                 # parenthesized initialization
-
-const char*
-__demangle_tree::__parse_new_expr(const char* first, const char* last)
-{
-    if (last - first >= 4)
-    {
-        const char* t = first;
-        bool parsed_gs = false;
-        if (t[0] == 'g' && t[1] == 's')
-        {
-            t += 2;
-            parsed_gs = true;
-        }
-        if (t[0] == 'n' && (t[1] == 'w' || t[1] == 'a'))
-        {
-            bool is_array = t[1] == 'a';
-            t += 2;
-            if (t == last)
-                return first;
-            __node* expr = 0;
-            __node* prev = 0;
-            while (*t != '_')
-            {
-                const char* t1 = __parse_expression(t, last);
-                if (t1 == t || t1 == last)
-                    return first;
-                if (!__make<__list>(__root_))
-                    return first;
-                if (expr == 0)
-                    expr = __root_;
-                if (prev)
-                {
-                    prev->__right_ = __root_;
-                    __root_->__size_ = prev->__size_ + 1;
-                }
-                prev = __root_;
-                t = t1;
-            }
-            ++t;
-            const char* t1 = __parse_type(t, last);
-            if (t1 == t || t1 == last)
-                return first;
-            t = t1;
-            __node* type = __root_;
-            __node* init = 0;
-            prev = 0;
-            bool has_init = false;
-            if (last - t >= 3 && t[0] == 'p' && t[1] == 'i')
-            {
-                t += 2;
-                has_init = true;
-                while (*t != 'E')
-                {
-                    t1 = __parse_expression(t, last);
-                    if (t1 == t || t1 == last)
-                        return first;
-                    if (!__make<__list>(__root_))
-                        return first;
-                    if (init == 0)
-                        init = __root_;
-                    if (prev)
-                    {
-                        prev->__right_ = __root_;
-                        __root_->__size_ = prev->__size_ + 1;
-                    }
-                    prev = __root_;
-                    t = t1;
-                }
-            }
-            if (*t != 'E')
-                return first;
-            if (__make<__new_expr>(parsed_gs, is_array, has_init,
-                                   expr, type, init))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// pt <expression> <unresolved-name>                    # expr->name
-
-const char*
-__demangle_tree::__parse_arrow_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'p' && first[1] == 't')
-    {
-        const char* t = __parse_expression(first+2, last);
-        if (t != first+2)
-        {
-            __node* expr = __root_;
-            const char* t1 = __parse_unresolved_name(t, last);
-            if (t1 != t)
-            {
-                if (__make<__arrow_expr>(expr, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// rc <type> <expression>                               # reinterpret_cast<type> (expression)
-
-const char*
-__demangle_tree::__parse_reinterpret_cast_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 'r' && first[1] == 'c')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            __node* type = __root_;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__reinterpret_cast>(type, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// sc <type> <expression>                               # static_cast<type> (expression)
-
-const char*
-__demangle_tree::__parse_static_cast_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 's' && first[1] == 'c')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            __node* type = __root_;
-            const char* t1 = __parse_expression(t, last);
-            if (t1 != t)
-            {
-                if (__make<__static_cast>(type, __root_))
-                    first = t1;
-            }
-        }
-    }
-    return first;
-}
-
-// st <type>                                            # sizeof (a type)
-
-const char*
-__demangle_tree::__parse_sizeof_type_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 's' && first[1] == 't')
-    {
-        const char* t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__operator_sizeof_expression>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// sZ <template-param>                                  # size of a parameter pack
-
-const char*
-__demangle_tree::__parse_sizeof_param_pack_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 's' && first[1] == 'Z' && first[2] == 'T')
-    {
-        const char* t = __parse_template_param(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__operator_sizeof_param_pack>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// sZ <function-param>                                  # size of a function parameter pack
-
-const char*
-__demangle_tree::__parse_sizeof_function_param_pack_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 's' && first[1] == 'Z' && first[2] == 'f')
-    {
-        const char* t = __parse_function_param(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__operator_sizeof_param_pack>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// sp <expression>                                  # pack expansion
-
-const char*
-__demangle_tree::__parse_pack_expansion(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 's' && first[1] == 'p')
-    {
-        const char* t = __parse_expression(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__pack_expansion>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// te <expression>                                      # typeid (expression)
-// ti <type>                                            # typeid (type)
-
-const char*
-__demangle_tree::__parse_typeid_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 't' && (first[1] == 'e' || first[1] == 'i'))
-    {
-        const char* t;
-        if (first[1] == 'e')
-            t = __parse_expression(first+2, last);
-        else
-            t = __parse_type(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__typeid>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// tw <expression>                                      # throw expression
-
-const char*
-__demangle_tree::__parse_throw_expr(const char* first, const char* last)
-{
-    if (last - first >= 3 && first[0] == 't' && first[1] == 'w')
-    {
-        const char* t = __parse_expression(first+2, last);
-        if (t != first+2)
-        {
-            if (__make<__throw>(__root_))
-                first = t;
-        }
-    }
-    return first;
-}
-
-// <expression> ::= <unary operator-name> <expression>
-//              ::= <binary operator-name> <expression> <expression>
-//              ::= <ternary operator-name> <expression> <expression> <expression>
-//              ::= cl <expression>+ E                                   # call
-//              ::= cv <type> <expression>                               # conversion with one argument
-//              ::= cv <type> _ <expression>* E                          # conversion with a different number of arguments
-//              ::= [gs] nw <expression>* _ <type> E                     # new (expr-list) type
-//              ::= [gs] nw <expression>* _ <type> <initializer>         # new (expr-list) type (init)
-//              ::= [gs] na <expression>* _ <type> E                     # new[] (expr-list) type
-//              ::= [gs] na <expression>* _ <type> <initializer>         # new[] (expr-list) type (init)
-//              ::= [gs] dl <expression>                                 # delete expression
-//              ::= [gs] da <expression>                                 # delete[] expression
-//              ::= pp_ <expression>                                     # prefix ++
-//              ::= mm_ <expression>                                     # prefix --
-//              ::= ti <type>                                            # typeid (type)
-//              ::= te <expression>                                      # typeid (expression)
-//              ::= dc <type> <expression>                               # dynamic_cast<type> (expression)
-//              ::= sc <type> <expression>                               # static_cast<type> (expression)
-//              ::= cc <type> <expression>                               # const_cast<type> (expression)
-//              ::= rc <type> <expression>                               # reinterpret_cast<type> (expression)
-//              ::= st <type>                                            # sizeof (a type)
-//              ::= at <type>                                            # alignof (a type)
-//              ::= <template-param>
-//              ::= <function-param>
-//              ::= dt <expression> <unresolved-name>                    # expr.name
-//              ::= pt <expression> <unresolved-name>                    # expr->name
-//              ::= ds <expression> <expression>                         # expr.*expr
-//              ::= sZ <template-param>                                  # size of a parameter pack
-//              ::= sZ <function-param>                                  # size of a function parameter pack
-//              ::= sp <expression>                                      # pack expansion
-//              ::= tw <expression>                                      # throw expression
-//              ::= tr                                                   # throw with no operand (rethrow)
-//              ::= <unresolved-name>                                    # f(p), N::f(p), ::f(p),
-//                                                                       # freestanding dependent name (e.g., T::x),
-//                                                                       # objectless nonstatic member reference
-//              ::= <expr-primary>
-
-const char*
-__demangle_tree::__parse_expression(const char* first, const char* last)
-{
-    if (last - first >= 2)
-    {
-        const char* t = first;
-        bool parsed_gs = false;
-        if (last - first >= 4 && t[0] == 'g' && t[1] == 's')
-        {
-            t += 2;
-            parsed_gs = true;
-        }
-        switch (*t)
-        {
-        case 'L':
-            t = __parse_expr_primary(first, last);
-            break;
-        case 'T':
-            t = __parse_template_param(first, last);
-            break;
-        case 'f':
-            t = __parse_function_param(first, last);
-            break;
-        case 'a':
-            if (t[1] == 't')
-                t = __parse_alignof_expr(first, last);
-            break;
-        case 'c':
-            switch (t[1])
-            {
-            case 'c':
-                t = __parse_const_cast_expr(first, last);
-                break;
-            case 'l':
-                t = __parse_call_expr(first, last);
-                break;
-            case 'v':
-                t = __parse_conversion_expr(first, last);
-                break;
-            }
-            break;
-        case 'd':
-            switch (t[1])
-            {
-            case 'a':
-                t = __parse_delete_array_expr(first, last);
-                break;
-            case 'c':
-                t = __parse_dynamic_cast_expr(first, last);
-                break;
-            case 'l':
-                t = __parse_delete_expr(first, last);
-                break;
-            case 's':
-                t = __parse_dot_star_expr(first, last);
-                break;
-            case 't':
-                t = __parse_dot_expr(first, last);
-                break;
-            }
-            break;
-        case 'm':
-            t = __parse_decrement_expr(first, last);
-            break;
-        case 'n':
-            switch (t[1])
-            {
-            case 'a':
-            case 'w':
-                t = __parse_new_expr(first, last);
-                break;
-            }
-            break;
-        case 'p':
-            switch (t[1])
-            {
-            case 'p':
-                t = __parse_increment_expr(first, last);
-                break;
-            case 't':
-                t = __parse_arrow_expr(first, last);
-                break;
-            }
-            break;
-        case 'r':
-            t = __parse_reinterpret_cast_expr(first, last);
-            break;
-        case 's':
-            switch (t[1])
-            {
-            case 'c':
-                t = __parse_static_cast_expr(first, last);
-                break;
-            case 'p':
-                t = __parse_pack_expansion(first, last);
-                break;
-            case 't':
-                t = __parse_sizeof_type_expr(first, last);
-                break;
-            case 'Z':
-                if (last - t >= 3)
-                {
-                    switch (t[2])
-                    {
-                    case 'T':
-                        t = __parse_sizeof_param_pack_expr(first, last);
-                        break;
-                    case 'f':
-                        t = __parse_sizeof_function_param_pack_expr(first, last);
-                        break;
-                    }
-                }
-                break;
-            }
-            break;
-        case 't':
-            switch (t[1])
-            {
-            case 'e':
-            case 'i':
-                t = __parse_typeid_expr(first, last);
-                break;
-            case 'r':
-                if (__make<__rethrow>())
-                    t = first +2;
-                break;
-            case 'w':
-                t = __parse_throw_expr(first, last);
-                break;
-            }
-            break;
-        }
-        if ((!parsed_gs && t == first) || (parsed_gs && t == first+2))
-        {
-            int op;
-            t = __parse_operator_name(first, last, &op);
-            if (t == first)
-                first = __parse_unresolved_name(first, last);
-            else
-                first = t;
-        }
-        else
-            first = t;
-    }
-    return first;
-}
-
-// <array-type> ::= A <positive dimension number> _ <element type>
-//              ::= A [<dimension expression>] _ <element type>
-
-const char*
-__demangle_tree::__parse_array_type(const char* first, const char* last)
-{
-    if (first != last && *first == 'A' && first+1 != last)
-    {
-        if (first[1] == '_')
-        {
-            const char* t = __parse_type(first+2, last);
-            if (t != first+2)
-            {
-                if (__make<__array>(__root_))
-                    first = t;
-            }
-        }
-        else if ('1' <= first[1] && first[1] <= '9')
-        {
-            size_t dim = static_cast<size_t>(first[1] - '0');
-            const char* t = first+2;
-            for (; t != last && isdigit(*t); ++t)
-                dim = dim * 10 + static_cast<size_t>(*t - '0');
-            if (t != last && *t == '_')
-            {
-                const char* t2 = __parse_type(t+1, last);
-                if (t2 != t+1)
-                {
-                    if (__make<__array>(__root_, dim))
-                        first = t2;
-                }
-            }
-        }
-        else
-        {
-            const char* t = __parse_expression(first+1, last);
-            if (t != first+1 && t != last && *t == '_')
-            {
-                __node* dim = __root_;
-                const char* t2 = __parse_type(++t, last);
-                if (t2 != t)
-                {
-                    if (__make<__array>(__root_, dim))
-                        first = t2;
-                }
-            }
-        }
-    }
-    return first;
-}
-
-// <class-enum-type> ::= <name>
-
-const char*
-__demangle_tree::__parse_class_enum_type(const char* first, const char* last)
-{
-    return __parse_name(first, last);
-}
-
-// <pointer-to-member-type> ::= M <class type> <member type>
-
-const char*
-__demangle_tree::__parse_pointer_to_member_type(const char* first, const char* last)
-{
-    if (first != last && *first == 'M')
-    {
-        const char* t = __parse_type(first+1, last);
-        if (t != first+1)
-        {
-            __node* class_type = __root_;
-            const char* t2 = __parse_type(t, last, true, true);
-            if (t2 != t)
-            {
-                if (__make<__pointer_to_member_type>(class_type, __root_))
-                    first = t2;
-            }
-        }
-    }
-    return first;
-}
-
-// <decltype>  ::= Dt <expression> E  # decltype of an id-expression or class member access (C++0x)
-//             ::= DT <expression> E  # decltype of an expression (C++0x)
-
-const char*
-__demangle_tree::__parse_decltype(const char* first, const char* last)
-{
-    if (last - first >= 4 && first[0] == 'D')
-    {
-        switch (first[1])
-        {
-        case 't':
-        case 'T':
-            {
-                const char* t = __parse_expression(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                {
-                    if (__make<__decltype_node>(__root_))
-                        first = t+1;
-                }
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <template-param> ::= T_    # first template parameter
-//                  ::= T <parameter-2 non-negative number> _
-
-const char*
-__demangle_tree::__parse_template_param(const char* first, const char* last)
-{
-    if (last - first >= 2)
-    {
-        if (*first == 'T')
-        {
-            if (first[1] == '_')
-            {
-                if (__t_begin_ != __t_end_)
-                {
-                    if (__make<__sub>(*__t_begin_))
-                        first += 2;
-                }
-                else
-                {
-                    if (__make<__sub>(size_t(0)))
-                    {
-                        first += 2;
-                        __fix_forward_references_ = true;
-                    }
-                }
-            }
-            else if (isdigit(first[1]))
-            {
-                const char* t = first+1;
-                size_t sub = static_cast<size_t>(*t - '0');
-                for (++t; t != last && isdigit(*t); ++t)
-                {
-                    sub *= 10;
-                    sub += static_cast<size_t>(*t - '0');
-                }
-                if (t == last || *t != '_')
-                    return first;
-                ++sub;
-                if (sub < static_cast<size_t>(__t_end_ - __t_begin_))
-                {
-                    if (__make<__sub>(__t_begin_[sub]))
-                        first = t+1;
-                }
-                else
-                {
-                    if (__make<__sub>(sub))
-                    {
-                        first = t+1;
-                        __fix_forward_references_ = true;
-                    }
-                }
-            }
-        }
-    }
-    return first;
-}
-
-// extension:
-// <vector-type>           ::= Dv <positive dimension number> _
-//                                    <extended element type>
-//                         ::= Dv [<dimension expression>] _ <element type>
-// <extended element type> ::= <element type>
-//                         ::= p # AltiVec vector pixel
-
-const char*
-__demangle_tree::__parse_vector_type(const char* first, const char* last)
-{
-    if (last - first > 3 && first[0] == 'D' && first[1] == 'v')
-    {
-        if ('1' <= first[2] && first[2] <= '9')
-        {
-            const char* t = first+3;
-            while (*t != '_')
-            {
-                if (!isdigit(*t) || ++t == last)
-                    return first;
-            }
-            const char* num = first + 2;
-            size_t sz = static_cast<size_t>(t - num);
-            if (++t != last)
-            {
-                if (*t != 'p')
-                {
-                    const char* t1 = __parse_type(t, last);
-                    if (t1 != t)
-                    {
-                        if (__make<__vector_type>(__root_, num, sz))
-                            first = t1;
-                    }
-                }
-                else
-                {
-                    ++t;
-                    if (__make<__vector_type>((__node*)0, num, sz))
-                        first = t;
-                }
-            }
-        }
-        else
-        {
-            __node* num = 0;
-            const char* t1 = first+2;
-            if (*t1 != '_')
-            {
-                const char* t = __parse_expression(t1, last);
-                if (t != t1)
-                    num = __root_;
-                t1 = t;
-            }
-            if (t1 != last && *t1 == '_' && ++t1 != last)
-            {
-                const char* t = __parse_type(t1, last);
-                if (t != t1)
-                {
-                    if (__make<__vector_type>(__root_, num))
-                        first = t;
-                }
-            }
-        }
-    }
-    return first;
-}
-
-// <type> ::= <builtin-type>
-//        ::= <function-type>
-//        ::= <class-enum-type>
-//        ::= <array-type>
-//        ::= <pointer-to-member-type>
-//        ::= <template-param>
-//        ::= <template-template-param> <template-args>
-//        ::= <decltype>
-//        ::= <substitution>
-//        ::= <CV-qualifiers> <type>
-//        ::= P <type>        # pointer-to
-//        ::= R <type>        # reference-to
-//        ::= O <type>        # rvalue reference-to (C++0x)
-//        ::= C <type>        # complex pair (C 2000)
-//        ::= G <type>        # imaginary (C 2000)
-//        ::= Dp <type>       # pack expansion (C++0x)
-//        ::= U <source-name> <type>  # vendor extended type qualifier
-// extension := <vector-type> # <vector-type> starts with Dv
-
-const char*
-__demangle_tree::__parse_type(const char* first, const char* last,
-                              bool try_to_parse_template_args,
-                              bool look_for_ref_quals)
-{
-    unsigned cv = 0;
-    const char* t = __parse_cv_qualifiers(first, last, cv, look_for_ref_quals);
-    if (t != first)
-    {
-        const char* t2 = __parse_type(t, last, try_to_parse_template_args);
-        if (t2 != t)
-        {
-            if (__make<__cv_qualifiers>(cv, __root_))
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else
-                {
-                    *__sub_end_++ = __root_;
-                    first = t2;
-                }
-            }
-        }
-        return first;
-    }
-    if (first != last)
-    {
-        switch (*first)
-        {
-        case 'A':
-            t = __parse_array_type(first, last);
-            if (t != first)
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else
-                {
-                    *__sub_end_++ = __root_;
-                    first = t;
-                }
-            }
-            break;
-        case 'C':
-            t = __parse_type(first+1, last, try_to_parse_template_args);
-            if (t != first+1)
-            {
-                if (__make<__d_complex>(__root_))
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-                return first;
-            }
-            break;
-        case 'F':
-            t = __parse_function_type(first, last);
-            if (t != first)
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else
-                {
-                    *__sub_end_++ = __root_;
-                    first = t;
-                }
-            }
-            break;
-        case 'G':
-            t = __parse_type(first+1, last, try_to_parse_template_args);
-            if (t != first+1)
-            {
-                if (__make<__imaginary>(__root_))
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-                return first;
-            }
-            break;
-        case 'M':
-            t = __parse_pointer_to_member_type(first, last);
-            if (t != first)
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else
-                {
-                    *__sub_end_++ = __root_;
-                    first = t;
-                }
-            }
-            break;
-        case 'O':
-            t = __parse_type(first+1, last, try_to_parse_template_args);
-            if (t != first+1)
-            {
-                if (__make<__rvalue_reference_to>(__root_))
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-                return first;
-            }
-            break;
-        case 'P':
-            t = __parse_type(first+1, last, try_to_parse_template_args);
-            if (t != first+1)
-            {
-                if (__make<__pointer_to>(__root_))
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-                return first;
-            }
-            break;
-        case 'R':
-            t = __parse_type(first+1, last, try_to_parse_template_args);
-            if (t != first+1)
-            {
-                if (__make<__lvalue_reference_to>(__root_))
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-                return first;
-            }
-            break;
-        case 'T':
-            t = __parse_template_param(first, last);
-            if (t != first)
-            {
-                if (__sub_end_ == __sub_cap_)
-                    __status_ = memory_alloc_failure;
-                else 
-                {
-                    *__sub_end_++ = __root_;
-                    if (try_to_parse_template_args)
-                    {
-                        const char* t2 = __parse_template_args(t, last);
-                        if (t2 != t)
-                        {
-                            if (__sub_end_ < __sub_cap_)
-                            {
-                                *__sub_end_++ = __root_;
-                                first = t2;
-                            }
-                            else
-                                __status_ = memory_alloc_failure;
-                        }
-                        else
-                        {
-                            first = t;
-                        }
-                    }
-                    else
-                    {
-                        first = t;
-                    }
-                }
-            }
-            break;
-        case 'U':
-            if (first+1 != last)
-            {
-                t = __parse_source_name(first+1, last);
-                if (t != first+1)
-                {
-                    __node*  name = __root_;
-                    const char* t2 = __parse_type(t, last, try_to_parse_template_args);
-                    if (t2 != t)
-                    {
-                        if (__make<__extended_qualifier>(name, __root_))
-                        {
-                            if (__sub_end_ == __sub_cap_)
-                                __status_ = memory_alloc_failure;
-                            else
-                            {
-                                *__sub_end_++ = __root_;
-                                first = t2;
-                            }
-                        }
-                        return first;
-                    }
-                }
-            }
-            break;
-        case 'S':
-            if (first+1 != last && first[1] == 't')
-            {
-                t = __parse_class_enum_type(first, last);
-                if (t != first)
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-            }
-            else
-            {
-                t = __parse_substitution(first, last);
-                if (t != first)
-                {
-                    first = t;
-                    // Parsed a substitution.  If the substitution is a
-                    //  <template-param> it might be followed by <template-args>.
-                    t = __parse_template_args(first, last);
-                    if (t != first)
-                    {
-                        // Need to create substitution for <template-template-param> <template-args>
-                        if (__sub_end_ == __sub_cap_)
-                            __status_ = memory_alloc_failure;
-                        else
-                        {
-                            *__sub_end_++ = __root_;
-                            first = t;
-                        }
-                    }
-                }
-            }
-            break;
-        case 'D':
-            if (first+1 != last)
-            {
-                switch (first[1])
-                {
-                case 'p':
-                    t = __parse_type(first+2, last, try_to_parse_template_args);
-                    if (t != first+1)
-                    {
-                        if (__make<__pack_expansion>(__root_))
-                        {
-                            if (__sub_end_ == __sub_cap_)
-                                __status_ = memory_alloc_failure;
-                            else
-                            {
-                                *__sub_end_++ = __root_;
-                                first = t;
-                            }
-                        }
-                        return first;
-                    }
-                    break;
-                case 't':
-                case 'T':
-                    t = __parse_decltype(first, last);
-                    if (t != first)
-                    {
-                       if (__sub_end_ == __sub_cap_)
-                            __status_ = memory_alloc_failure;
-                        else
-                        {
-                            *__sub_end_++ = __root_;
-                            first = t;
-                        }
-                        return first;
-                    }
-                    break;
-                case 'v':
-                    t = __parse_vector_type(first, last);
-                    if (t != first)
-                    {
-                       if (__sub_end_ == __sub_cap_)
-                            __status_ = memory_alloc_failure;
-                        else
-                        {
-                            *__sub_end_++ = __root_;
-                            first = t;
-                        }
-                        return first;
-                    }
-                    break;
-                }
-            }
-            // drop through
-        default:
-            // must check for builtin-types before class-enum-types to avoid
-            // ambiguities with operator-names
-            t = __parse_builtin_type(first, last);
-            if (t != first)
-            {
-                first = t;
-            }
-            else
-            {
-                t = __parse_class_enum_type(first, last);
-                if (t != first)
-                {
-                    if (__sub_end_ == __sub_cap_)
-                        __status_ = memory_alloc_failure;
-                    else
-                    {
-                        *__sub_end_++ = __root_;
-                        first = t;
-                    }
-                }
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <number> ::= [n] <non-negative decimal integer>
-
-const char*
-__demangle_tree::__parse_number(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        const char* t = first;
-        if (*t == 'n')
-            ++t;
-        if (t != last)
-        {
-            if (*t == '0')
-            {
-                first = t+1;
-            }
-            else if ('1' <= *t && *t <= '9')
-            {
-                first = t+1;
-                while (first != last && isdigit(*first))
-                    ++first;
-            }
-        }
-    }
-    return first;
-}
-
-// <call-offset> ::= h <nv-offset> _
-//               ::= v <v-offset> _
-// 
-// <nv-offset> ::= <offset number>
-//               # non-virtual base override
-// 
-// <v-offset>  ::= <offset number> _ <virtual offset number>
-//               # virtual base override, with vcall offset
-
-const char*
-__demangle_tree::__parse_call_offset(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        switch (*first)
-        {
-        case 'h':
-            {
-            const char* t = __parse_number(first + 1, last);
-            if (t != first + 1 && t != last && *t == '_')
-                first = t + 1;
-            }
-            break;
-        case 'v':
-            {
-            const char* t = __parse_number(first + 1, last);
-            if (t != first + 1 && t != last && *t == '_')
-            {
-                const char* t2 = __parse_number(++t, last);
-                if (t2 != t && t2 != last && *t2 == '_')
-                    first = t2 + 1;
-            }
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <special-name> ::= TV <type>    # virtual table
-//                ::= TT <type>    # VTT structure (construction vtable index)
-//                ::= TI <type>    # typeinfo structure
-//                ::= TS <type>    # typeinfo name (null-terminated byte string)
-//                ::= Tc <call-offset> <call-offset> <base encoding>
-//                    # base is the nominal target function of thunk
-//                    # first call-offset is 'this' adjustment
-//                    # second call-offset is result adjustment
-//                ::= T <call-offset> <base encoding>
-//                    # base is the nominal target function of thunk
-//                ::= GV <object name> # Guard variable for one-time initialization
-//                                     # No <type>
-//      extension ::= TC <first type> <number> _ <second type> # construction vtable for second-in-first
-//      extension ::= GR <object name> # reference temporary for object
-
-const char*
-__demangle_tree::__parse_special_name(const char* first, const char* last)
-{
-    if (last - first > 2)
-    {
-        const char* t;
-        switch (*first)
-        {
-        case 'T':
-            switch (first[1])
-            {
-            case 'V':
-                // TV <type>    # virtual table
-                t = __parse_type(first+2, last);
-                if (t != first+2 && __make<__vtable>(__root_))
-                    first = t;
-                break;
-            case 'T':
-                // TT <type>    # VTT structure (construction vtable index)
-                t = __parse_type(first+2, last);
-                if (t != first+2 && __make<__VTT>(__root_))
-                    first = t;
-                break;
-            case 'I':
-                // TI <type>    # typeinfo structure
-                t = __parse_type(first+2, last);
-                if (t != first+2 && __make<__typeinfo>(__root_))
-                    first = t;
-                break;
-            case 'S':
-                // TS <type>    # typeinfo name (null-terminated byte string)
-                t = __parse_type(first+2, last);
-                if (t != first+2 && __make<__typeinfo_name>(__root_))
-                    first = t;
-                break;
-            case 'c':
-                // Tc <call-offset> <call-offset> <base encoding>
-                {
-                const char* t0 = __parse_call_offset(first+2, last);
-                if (t0 == first+2)
-                    break;
-                const char* t1 = __parse_call_offset(t0, last);
-                if (t1 == t0)
-                    break;
-                t = __parse_encoding(t1, last);
-                if (t != t1 && __make<__covariant_return_thunk>(__root_))
-                    first = t;
-                }
-                break;
-            case 'C':
-                // extension ::= TC <first type> <number> _ <second type> # construction vtable for second-in-first
-                t = __parse_type(first+2, last);
-                if (t != first+2)
-                {
-                    __node* op1 = __root_;
-                    const char* t0 = __parse_number(t, last);
-                    if (t0 != t && t0 != last && *t0 == '_')
-                    {
-                        const char* t1 = __parse_type(++t0, last);
-                        if (t1 != t0)
-                        {
-                            if (__make<__construction_vtable>(__root_, op1))
-                                first = t1;
-                        }
-                    }
-                }
-                break;
-            default:
-                // T <call-offset> <base encoding>
-                {
-                const char* t0 = __parse_call_offset(first+1, last);
-                if (t0 == first+1)
-                    break;
-                t = __parse_encoding(t0, last);
-                if (t != t0)
-                {
-                    if (first[2] == 'v')
-                    {
-                        if (__make<__virtual_thunk>(__root_))
-                            first = t;
-                    }
-                    else
-                    {
-                        if (__make<__non_virtual_thunk>(__root_))
-                            first = t;
-                    }
-                }
-                }
-                break;
-            }
-            break;
-        case 'G':
-            switch (first[1])
-            {
-            case 'V':
-                // GV <object name> # Guard variable for one-time initialization
-                t = __parse_name(first+2, last);
-                if (t != first+2 && __make<__guard_variable>(__root_))
-                    first = t;
-                break;
-            case 'R':
-                // extension ::= GR <object name> # reference temporary for object
-                t = __parse_name(first+2, last);
-                if (t != first+2 && __make<__reference_temporary>(__root_))
-                    first = t;
-                break;
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <operator-name>
-//                 ::= aa         # &&            
-//                 ::= ad         # & (unary)
-//                 ::= an         # &             
-//                 ::= aN         # &=            
-//                 ::= aS         # =             
-//                 ::= at         # alignof (a type)
-//                 ::= az         # alignof (an expression)
-//                 ::= cl         # ()            
-//                 ::= cm         # ,             
-//                 ::= co         # ~             
-//                 ::= cv <type>  # (cast)        
-//                 ::= da         # delete[]
-//                 ::= de         # * (unary)     
-//                 ::= dl         # delete        
-//                 ::= dv         # /             
-//                 ::= dV         # /=            
-//                 ::= eo         # ^             
-//                 ::= eO         # ^=            
-//                 ::= eq         # ==            
-//                 ::= ge         # >=            
-//                 ::= gt         # >             
-//                 ::= ix         # []            
-//                 ::= le         # <=            
-//                 ::= ls         # <<            
-//                 ::= lS         # <<=           
-//                 ::= lt         # <             
-//                 ::= mi         # -             
-//                 ::= mI         # -=            
-//                 ::= ml         # *             
-//                 ::= mL         # *=            
-//                 ::= mm         # -- (postfix in <expression> context)           
-//                 ::= na         # new[]
-//                 ::= ne         # !=            
-//                 ::= ng         # - (unary)     
-//                 ::= nt         # !             
-//                 ::= nw         # new           
-//                 ::= oo         # ||            
-//                 ::= or         # |             
-//                 ::= oR         # |=            
-//                 ::= pm         # ->*           
-//                 ::= pl         # +             
-//                 ::= pL         # +=            
-//                 ::= pp         # ++ (postfix in <expression> context)
-//                 ::= ps         # + (unary)
-//                 ::= pt         # ->            
-//                 ::= qu         # ?             
-//                 ::= rm         # %             
-//                 ::= rM         # %=            
-//                 ::= rs         # >>            
-//                 ::= rS         # >>=           
-//                 ::= st         # sizeof (a type)
-//                 ::= sz         # sizeof (an expression)
-//                 ::= v <digit> <source-name> # vendor extended operator
-
-const char*
-__demangle_tree::__parse_operator_name(const char* first, const char* last, int* type)
-{
-    if (last - first >= 2)
-    {
-        switch (*first)
-        {
-        case 'a':
-            switch (first[1])
-            {
-            case 'a':
-                // &&
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_logical_and>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_logical_and>())
-                        first += 2;
-                }
-                break;
-            case 'd':
-                // & (unary)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_addressof>(__root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_addressof>())
-                        first += 2;
-                }
-                break;
-            case 'n':
-                // &
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_bit_and>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_bit_and>())
-                        first += 2;
-                }
-                break;
-            case 'N':
-                // &=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_and_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_and_equal>())
-                        first += 2;
-                }
-                break;
-            case 'S':
-                // =
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_equal>())
-                        first += 2;
-                }
-                break;
-            case 't':
-                // alignof (a type)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_alignof_type>(__root_))
-                        {
-                            *type = -1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_alignof_type>())
-                        first += 2;
-                }
-                break;
-            case 'z':
-                // alignof (an expression)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_alignof_expression>(__root_))
-                        {
-                            *type = -1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_alignof_expression>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'c':
-            switch (first[1])
-            {
-            case 'l':
-                // ()
-                if (__make<__operator_paren>())
-                {
-                    first += 2;
-                    if (type)
-                        *type = -1;
-                }
-                break;
-            case 'm':
-                // ,
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_comma>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_comma>())
-                        first += 2;
-                }
-                break;
-            case 'o':
-                // ~
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_tilda>(__root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_tilda>())
-                        first += 2;
-                }
-                break;
-            case 'v':
-                // cast <type>
-                {
-                const char* t = __parse_type(first+2, last, false, true);
-                if (t != first+2)
-                {
-                    __node* cast_type = __root_;
-                    if (type)
-                    {
-                        const char* t2 = __parse_expression(t, last);
-                        if (t2 != t)
-                        {
-                            if (__make<__operator_cast>(cast_type, __root_))
-                            {
-                                *type = -1;
-                                first = t2;
-                            }
-                        }
-                    }
-                    else
-                    {
-                        if (__make<__operator_cast>(cast_type))
-                            first = t;
-                    }
-                }
-                }
-                break;
-            }
-            break;
-        case 'd':
-            switch (first[1])
-            {
-            case 'a':
-                // delete[]
-                if (__make<__operator_delete_array>())
-                {
-                    first += 2;
-                    if (type)
-                        *type = -1;
-                }
-                break;
-            case 'e':
-                // * (unary)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_dereference>(__root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_dereference>())
-                        first += 2;
-                }
-                break;
-            case 'l':
-                // delete
-                if (__make<__operator_delete>())
-                {
-                    first += 2;
-                    if (type)
-                        *type = -1;
-                }
-                break;
-            case 'v':
-                // /
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_divide>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_divide>())
-                        first += 2;
-                }
-                break;
-            case 'V':
-                // /=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_divide_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_divide_equal>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'e':
-            switch (first[1])
-            {
-            case 'o':
-                // ^
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_xor>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_xor>())
-                        first += 2;
-                }
-                break;
-            case 'O':
-                // ^=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_xor_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_xor_equal>())
-                        first += 2;
-                }
-                break;
-            case 'q':
-                // ==
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_equality>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_equality>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'g':
-            switch (first[1])
-            {
-            case 'e':
-                // >=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_greater_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_greater_equal>())
-                        first += 2;
-                }
-                break;
-            case 't':
-                // >
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_greater>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_greater>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'i':
-            // []
-            if (first[1] == 'x' && __make<__operator_brackets>())
-                {
-                first += 2;
-                    if (type)
-                        *type = -1;
-                }
-            break;
-        case 'l':
-            switch (first[1])
-            {
-            case 'e':
-                // <=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_less_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_less_equal>())
-                        first += 2;
-                }
-                break;
-            case 's':
-                // <<
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_left_shift>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_left_shift>())
-                        first += 2;
-                }
-                break;
-            case 'S':
-                // <<=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_left_shift_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_left_shift_equal>())
-                        first += 2;
-                }
-                break;
-            case 't':
-                // <
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_less>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_less>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'm':
-            switch (first[1])
-            {
-            case 'i':
-                // -
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_minus>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_minus>())
-                        first += 2;
-                }
-                break;
-            case 'I':
-                // -=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_minus_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_minus_equal>())
-                        first += 2;
-                }
-                break;
-            case 'l':
-                // *
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_times>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_times>())
-                        first += 2;
-                }
-                break;
-            case 'L':
-                // *=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_times_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_times_equal>())
-                        first += 2;
-                }
-                break;
-            case 'm':
-                // -- (postfix in <expression> context)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_decrement>(false, __root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_decrement>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'n':
-            switch (first[1])
-            {
-            case 'a':
-                // new[]
-                if (__make<__operator_new_array>())
-                {
-                    first += 2;
-                    if (type)
-                        *type = -1;
-                }
-                break;
-            case 'e':
-                // !=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_not_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_not_equal>())
-                        first += 2;
-                }
-                break;
-            case 'g':
-                // - (unary)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_negate>(__root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_negate>())
-                        first += 2;
-                }
-                break;
-            case 't':
-                // !
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_logical_not>(__root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_logical_not>())
-                        first += 2;
-                }
-                break;
-            case 'w':
-                // new
-                if (__make<__operator_new>())
-                {
-                    first += 2;
-                    if (type)
-                        *type = -1;
-                }
-                break;
-            }
-            break;
-        case 'o':
-            switch (first[1])
-            {
-            case 'o':
-                // ||
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_logical_or>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_logical_or>())
-                        first += 2;
-                }
-                break;
-            case 'r':
-                // |
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_bit_or>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_bit_or>())
-                        first += 2;
-                }
-                break;
-            case 'R':
-                // |=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_or_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_or_equal>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'p':
-            switch (first[1])
-            {
-            case 'm':
-                // ->*
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_pointer_to_member>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_pointer_to_member>())
-                        first += 2;
-                }
-                break;
-            case 'l':
-                // +
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_plus>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_plus>())
-                        first += 2;
-                }
-                break;
-            case 'L':
-                // +=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_plus_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_plus_equal>())
-                        first += 2;
-                }
-                break;
-            case 'p':
-                // ++ (postfix in <expression> context)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_increment>(false, __root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_increment>())
-                        first += 2;
-                }
-                break;
-            case 's':
-                // + (unary)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_unary_plus>(__root_))
-                        {
-                            *type = 1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_unary_plus>())
-                        first += 2;
-                }
-                break;
-            case 't':
-                // ->
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_arrow>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_arrow>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 'q':
-            // ?
-            if (first[1] == 'u')
-            {
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            __node* op2 = __root_;
-                            const char* t3 = __parse_expression(t2, last);
-                            if (t3 != t2)
-                            {
-                                if (__make<__operator_conditional>(op1, op2, __root_))
-                                {
-                                    *type = 3;
-                                    first = t3;
-                                }
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_conditional>())
-                        first += 2;
-                }
-            }
-            break;
-        case 'r':
-            switch (first[1])
-            {
-            case 'm':
-                // %
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_mod>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_mod>())
-                        first += 2;
-                }
-                break;
-            case 'M':
-                // %=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_mod_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_mod_equal>())
-                        first += 2;
-                }
-                break;
-            case 's':
-                // >>
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_right_shift>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_right_shift>())
-                        first += 2;
-                }
-                break;
-            case 'S':
-                // >>=
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        __node* op1 = __root_;
-                        const char* t2 = __parse_expression(t, last);
-                        if (t != t2)
-                        {
-                            if (__make<__operator_right_shift_equal>(op1, __root_))
-                            {
-                                *type = 2;
-                                first = t2;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_right_shift_equal>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        case 's':
-            switch (first[1])
-            {
-            case 't':
-                // sizeof (a type)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_sizeof_type>(__root_))
-                        {
-                            *type = -1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_sizeof_type>())
-                        first += 2;
-                }
-                break;
-            case 'z':
-                // sizeof (an expression)
-                if (type)
-                {
-                    const char* t = __parse_expression(first+2, last);
-                    if (t != first+2)
-                    {
-                        if (__make<__operator_sizeof_expression>(__root_))
-                        {
-                            *type = -1;
-                            first = t;
-                        }
-                    }
-                }
-                else
-                {
-                    if (__make<__operator_sizeof_expression>())
-                        first += 2;
-                }
-                break;
-            }
-            break;
-        }
-    }
-    return first;
-}
-
-// <source-name> ::= <positive length number> <identifier>
-
-const char*
-__demangle_tree::__parse_source_name(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        char c = *first;
-        if ('1' <= c && c <= '9' && first+1 != last)
-        {
-            const char* t = first+1;
-            size_t n = static_cast<size_t>(c - '0');
-            for (c = *t; '0' <= c && c <= '9'; c = *t)
-            {
-                n = n * 10 + static_cast<size_t>(c - '0');
-                if (++t == last)
-                    return first;
-            }
-            if (static_cast<size_t>(last - t) >= n && __make<__source_name>(t, n))
-                first = t + n;
-        }
-    }
-    return first;
-}
-
-// <unqualified-name> ::= <operator-name>
-//                    ::= <ctor-dtor-name>
-//                    ::= <source-name>   
-//                    ::= <unnamed-type-name>
-
-const char*
-__demangle_tree::__parse_unqualified_name(const char* first, const char* last)
-{
-    const char* t = __parse_source_name(first, last);
-    if (t == first)
-    {
-        t = __parse_ctor_dtor_name(first, last);
-        if (t == first)
-        {
-            t = __parse_operator_name(first, last);
-            if (t == first)
-                first = __parse_unnamed_type_name(first, last);
-            else
-                first = t;
-        }
-        else
-            first = t;
-    }
-    else
-        first = t;
-    return first;
-}
-
-// <unscoped-name> ::= <unqualified-name>
-//                 ::= St <unqualified-name>   # ::std::
-// extension       ::= StL<unqualified-name>
-
-const char*
-__demangle_tree::__parse_unscoped_name(const char* first, const char* last)
-{
-    if (last - first >= 2)
-    {
-        const char* t0 = first;
-        if (first[0] == 'S' && first[1] == 't')
-        {
-            t0 += 2;
-            if (t0 != last && *t0 == 'L')
-                ++t0;
-        }
-        const char* t1 = __parse_unqualified_name(t0, last);
-        if (t1 != t0)
-        {
-            if (t0 != first)
-            {
-                __node* name = __root_;
-                if (__make<__std_qualified_name>())
-                {
-                    if (__make<__nested_delimeter>(__root_, name))
-                        first = t1;
-                }
-            }
-            else
-                first = t1;
-        }
-    }
-    return first;
-}
-
-// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
-//               ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
-// 
-// <prefix> ::= <prefix> <unqualified-name>
-//          ::= <template-prefix> <template-args>
-//          ::= <template-param>
-//          ::= <decltype>
-//          ::= # empty
-//          ::= <substitution>
-//          ::= <prefix> <data-member-prefix>
-//  extension ::= L
-// 
-// <template-prefix> ::= <prefix> <template unqualified-name>
-//                   ::= <template-param>
-//                   ::= <substitution>
-
-const char*
-__demangle_tree::__parse_nested_name(const char* first, const char* last)
-{
-    if (first != last && *first == 'N')
-    {
-        unsigned cv = 0;
-        const char* t0 = __parse_cv_qualifiers(first+1, last, cv, true);
-        __node* prev = NULL;
-        if (last - t0 >= 2 && t0[0] == 'S' && t0[1] == 't')
-        {
-            t0 += 2;
-            if (!__make<__std_qualified_name>())
-                return first;
-            prev = __root_;
-        }
-        while (t0 != last)
-        {
-            bool can_sub = true;
-            bool make_nested = true;
-            const char* t1 = NULL;
-            switch (*t0)
-            {
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-                t1 = __parse_source_name(t0, last);
-                if (t1 == t0 || t1 == last)
-                    return first;
-                if (*t1 == 'M')
-                {
-                    // This is a data-member-prefix
-                    ++t1;
-                }
-                else if (*t1 == 'I')
-                {
-                    // has following <template-args>
-                    if (prev)
-                    {
-                        if (!__make<__nested_delimeter>(prev, __root_))
-                            return first;
-                        make_nested = false;
-                    }
-                    if (__sub_end_ == __sub_cap_)
-                    {
-                        __status_ = memory_alloc_failure;
-                        return first;
-                    }
-                    else
-                        *__sub_end_++ = __root_;
-                    const char* t2 = __parse_template_args(t1, last);
-                    if (t2 == t1)
-                        return first;
-                    t1 = t2;
-                }
-                break;
-            case 'D':
-                if (t0+1 != last && (t0[1] == 't' || t0[1] == 'T'))
-                {
-                    t1 = __parse_decltype(t0, last);
-                    break;
-                }
-                // check for Dt, DT here, else drop through
-            case 'C':
-                t1 = __parse_ctor_dtor_name(t0, last);
-                if (t1 == t0 || t1 == last)
-                    return first;
-                if (*t1 == 'I')
-                {
-                    // has following <template-args>
-                    if (prev)
-                    {
-                        if (!__make<__nested_delimeter>(prev, __root_))
-                            return first;
-                        make_nested = false;
-                    }
-                    if (__sub_end_ == __sub_cap_)
-                    {
-                        __status_ = memory_alloc_failure;
-                        return first;
-                    }
-                    else
-                        *__sub_end_++ = __root_;
-                    const char* t2 = __parse_template_args(t1, last);
-                    if (t2 == t1)
-                        return first;
-                    t1 = t2;
-                }
-                break;
-            case 'U':
-                t1 = __parse_unnamed_type_name(t0, last);
-                if (t1 == t0 || t1 == last)
-                  return first;
-                break;
-            case 'T':
-                t1 = __parse_template_param(t0, last);
-                if (t1 == t0 || t1 == last)
-                    return first;
-                if (*t1 == 'I')
-                {
-                    // has following <template-args>
-                    if (prev)
-                    {
-                        if (!__make<__nested_delimeter>(prev, __root_))
-                            return first;
-                        make_nested = false;
-                    }
-                    if (__sub_end_ == __sub_cap_)
-                    {
-                        __status_ = memory_alloc_failure;
-                        return first;
-                    }
-                    else
-                        *__sub_end_++ = __root_;
-                    const char* t2 = __parse_template_args(t1, last);
-                    if (t2 == t1)
-                        return first;
-                    t1 = t2;
-                }
-                break;
-            case 'S':
-                t1 = __parse_substitution(t0, last);
-               if (t1 == t0 || t1 == last)
-                    return first;
-                if (*t1 == 'I')
-                {
-                    const char* t2 = __parse_template_args(t1, last);
-                    if (t2 == t1)
-                        return first;
-                    t1 = t2;
-                }
-                else
-                    can_sub = false;
-                break;
-            case 'L':
-                // extension: ignore L here
-                ++t0;
-                continue;
-            default:
-                t1 = __parse_operator_name(t0, last);
-                if (t1 == t0 || t1 == last)
-                    return first;
-                if (*t1 == 'I')
-                {
-                    // has following <template-args>
-                    if (prev)
-                    {
-                        if (!__make<__nested_delimeter>(prev, __root_))
-                            return first;
-                        make_nested = false;
-                    }
-                    if (__sub_end_ == __sub_cap_)
-                    {
-                        __status_ = memory_alloc_failure;
-                        return first;
-                    }
-                    else
-                        *__sub_end_++ = __root_;
-                    const char* t2 = __parse_template_args(t1, last);
-                    if (t2 == t1)
-                        return first;
-                    t1 = t2;
-                }
-                break;
-            }
-            if (t1 == t0 || t1 == last)
-                return first;
-            if (prev && make_nested)
-            {
-                if (!__make<__nested_delimeter>(prev, __root_))
-                    return first;
-                can_sub = true;
-            }
-            if (can_sub && *t1 != 'E')
-            {
-                if (__sub_end_ == __sub_cap_)
-                {
-                    __status_ = memory_alloc_failure;
-                    return first;
-                }
-                else
-                    *__sub_end_++ = __root_;
-            }
-            if (*t1 == 'E')
-            {
-                if (cv != 0)
-                {
-                    if (!__make<__cv_qualifiers>(cv, __root_))
-                        return first;
-                }
-                first = t1+1;
-                break;
-            }
-            prev = __root_;
-            t0 = t1;
-        }
-    }
-    return first;
-}
-
-// <template-arg> ::= <type>                                             # type or template
-//                ::= X <expression> E                                   # expression
-//                ::= <expr-primary>                                     # simple expressions
-//                ::= J <template-arg>* E                                # argument pack
-//                ::= LZ <encoding> E                                    # extension
-
-const char*
-__demangle_tree::__parse_template_arg(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        const char* t;
-        switch (*first)
-        {
-        case 'X':
-            t = __parse_expression(first+1, last);
-            if (t != first+1)
-            {
-                if (t != last && *t == 'E')
-                    first = t+1;
-            }
-            break;
-        case 'J':
-            t = first+1;
-            if (t == last)
-                return first;
-            if (*t == 'E')
-            {
-                if (__make<__list>((__node*)0))
-                    first = t+1;
-            }
-            else
-            {
-                __node* list = NULL;
-                __node* prev = NULL;
-                do
-                {
-                    const char* t2 = __parse_template_arg(t, last);
-                    if (t2 == t || !__make<__list>(__root_))
-                        return first;
-                    if (list == 0)
-                        list = __root_;
-                    if (prev)
-                    {
-                        prev->__right_ = __root_;
-                        __root_->__size_ = prev->__size_ + 1;
-                    }
-                    prev = __root_;
-                    t = t2;
-                } while (t != last && *t != 'E');
-                first = t+1;
-                __root_ = list;
-            }
-            break;
-        case 'L':
-            // <expr-primary> or LZ <encoding> E
-            if (first+1 != last && first[1] == 'Z')
-            {
-                t = __parse_encoding(first+2, last);
-                if (t != first+2 && t != last && *t == 'E')
-                    first = t+1;
-            }
-            else
-                first = __parse_expr_primary(first, last);
-            break;
-        default:
-            // <type>
-            first = __parse_type(first, last);
-            break;
-        }
-    }
-    return first;
-}
-
-// <template-args> ::= I <template-arg>* E
-//     extension, the abi says <template-arg>+
-
-const char*
-__demangle_tree::__parse_template_args(const char* first, const char* last)
-{
-    if (last - first >= 2 && *first == 'I')
-    {
-        __node* args = NULL;
-        __node* prev = NULL;
-        __node* name = __root_;
-        if (__tag_templates_)
-            __t_end_ = __t_begin_;
-        const char* t = first+1;
-        while (*t != 'E')
-        {
-            bool prev_tag_templates = __tag_templates_;
-            __node** prev_t_begin = __t_begin_;
-            __node** prev_t_end = __t_end_;
-            if (__tag_templates_)
-                __t_begin_ = __t_end_;
-            const char* t2 = __parse_template_arg(t, last);
-            if (prev_tag_templates)
-            {
-                __tag_templates_ = prev_tag_templates;
-                __t_begin_ = prev_t_begin;
-                __t_end_ = prev_t_end;
-            }
-            if (t2 == t || t2 == last)
-                break;
-            if (!__make<__list>(__root_))
-                return first;
-            if (args == 0)
-                args = __root_;
-            if (prev)
-            {
-                prev->__right_ = __root_;
-                __root_->__size_ = prev->__size_ + 1;
-            }
-            prev = __root_;
-            if (__tag_templates_)
-            {
-                if (__t_end_ == __t_cap_)
-                {
-                    __status_ = memory_alloc_failure;
-                    return first;
-                }
-                if (__root_->__left_)
-                    *__t_end_++ = __root_->__left_;
-                else
-                    *__t_end_++ = __root_;
-            }
-            t = t2;
-        }
-        if (t != last && *t == 'E')
-        {
-            if (__make<__template_args>(name, args))
-                first = t+1;
-        }
-    }
-    return first;
-}
-
-// <substitution> ::= S <seq-id> _
-//                ::= S_
-// <substitution> ::= Sa # ::std::allocator
-// <substitution> ::= Sb # ::std::basic_string
-// <substitution> ::= Ss # ::std::basic_string < char,
-//                                               ::std::char_traits<char>,
-//                                               ::std::allocator<char> >
-// <substitution> ::= Si # ::std::basic_istream<char,  std::char_traits<char> >
-// <substitution> ::= So # ::std::basic_ostream<char,  std::char_traits<char> >
-// <substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char> >
-
-const char*
-__demangle_tree::__parse_substitution(const char* first, const char* last)
-{
-    if (last - first >= 2)
-    {
-        if (*first == 'S')
-        {
-            switch (first[1])
-            {
-            case 'a':
-                if (__make<__sub_allocator>())
-                     first += 2;
-                break;
-            case 'b':
-                if (__make<__sub_basic_string>())
-                     first += 2;
-                break;
-            case 's':
-                if (__make<__sub_string>())
-                     first += 2;
-                break;
-            case 'i':
-                if (__make<__sub_istream>())
-                     first += 2;
-                break;
-            case 'o':
-                if (__make<__sub_ostream>())
-                     first += 2;
-                break;
-            case 'd':
-                if (__make<__sub_iostream>())
-                     first += 2;
-                break;
-            case '_':
-                if (__sub_begin_ != __sub_end_)
-                {
-                    if (__make<__sub>(*__sub_begin_))
-                        first += 2;
-                }
-                break;
-            default:
-                if (isdigit(first[1]) || isupper(first[1]))
-                {
-                    size_t sub = 0;
-                    const char* t = first+1;
-                    if (isdigit(*t))
-                        sub = static_cast<size_t>(*t - '0');
-                    else
-                        sub = static_cast<size_t>(*t - 'A') + 10;
-                    for (++t; t != last && (isdigit(*t) || isupper(*t)); ++t)
-                    {
-                        sub *= 36;
-                        if (isdigit(*t))
-                            sub += static_cast<size_t>(*t - '0');
-                        else
-                            sub += static_cast<size_t>(*t - 'A') + 10;
-                    }
-                    if (t == last || *t != '_')
-                        return first;
-                    ++sub;
-                    if (sub < static_cast<size_t>(__sub_end_ - __sub_begin_))
-                    {
-                        if (__make<__sub>(__sub_begin_[sub]))
-                            first = t+1;
-                    }
-                }
-                break;
-            }
-        }
-    }
-    return first;
-}
-
-// <name> ::= <nested-name>
-//        ::= <local-name> # See Scope Encoding below
-//        ::= <unscoped-template-name> <template-args>
-//        ::= <unscoped-name>
-
-const char*
-__demangle_tree::__parse_name(const char* first, const char* last)
-{
-    if (first != last)
-    {
-        const char* t0 = first;
-        // extension: ignore L here
-        if (*t0 == 'L')
-            ++t0;
-        const char* t = __parse_nested_name(t0, last);
-        if (t == t0)
-        {
-            t = __parse_local_name(t0, last);
-            if (t == t0)
-            {
-                // not <nested-name> nor <local-name>
-                // Try to parse <unscoped-template-name> <template-args> or
-                //   <unscoped-name> which are nearly ambiguous.
-                //   This logic occurs nowhere else.
-                if (last - t0 >= 2)
-                {
-                    if (t0[0] == 'S' && (t0[1] == '_'   ||
-                                            isdigit(t0[1]) ||
-                                            isupper(t0[1]) ||
-                                            t0[1] == 'a'   ||
-                                            t0[1] == 'b'))
-                    {
-                        t = __parse_substitution(t0, last);
-                        if (t != t0)
-                        {
-                            const char* t2 = __parse_template_args(t, last);
-                            if (t2 != t)
-                                first = t2;
-                        }
-                    }
-                    else  // Not a substitution, except maybe St
-                    {
-                        t = __parse_unscoped_name(t0, last);
-                        if (t != t0)
-                        {
-                            // unscoped-name might be <unscoped-template-name>
-                            if (t != last && *t == 'I')
-                            {
-                                if (__sub_end_ == __sub_cap_)
-                                {
-                                    __status_ = memory_alloc_failure;
-                                    return first;
-                                }
-                                *__sub_end_++ = __root_;
-                                const char* t2 = __parse_template_args(t, last);
-                                if (t2 != t)
-                                    first = t2;
-                            }
-                            else
-                            {
-                                // <unscoped-name>
-                                first = t;
-                            }
-                        }
-                    }
-                }
-            }
-            else
-                first = t;
-        }
-        else
-            first = t;
-    }
-    return first;
-}
-
-// extension
-// <dot-suffix> := .<anything and everything>
-
-const char*
-__demangle_tree::__parse_dot_suffix(const char* first, const char* last)
-{
-    if (first != last && *first == '.')
-    {
-        if (__make<__dot_suffix>(__root_, first, static_cast<size_t>(last-first)))
-            first = last;
-    }
-    return first;
-}
-
-// <encoding> ::= <function name> <bare-function-type>
-//            ::= <data name>
-//            ::= <special-name>
-
-const char*
-__demangle_tree::__parse_encoding(const char* first, const char* last)
-{
-    const char* t = __parse_name(first, last);
-    if (t != first)
-    {
-        if (t != last && *t != 'E' && *t != '.')
-        {
-            __node* name = __root_;
-            bool has_return = name->ends_with_template(true) &&
-                             !name->is_ctor_dtor_conv();
-            __node* ret = NULL;
-            const char* t2;
-            bool prev_tag_templates = __tag_templates_;
-            __tag_templates_ = false;
-            if (has_return)
-            {
-                t2 = __parse_type(t, last);
-                if (t2 != t)
-                {
-                    ret = __root_;
-                    t = t2;
-                }
-                else
-                    return first;
-            }
-            t2 = __parse_bare_function_type(t, last);
-            if (t2 != t)
-            {
-                if (dynamic_cast<__void*>(__root_->__left_) != NULL)
-                    __root_->__left_ = NULL;
-                if (__make<__function_signature>(ret, __root_))
-                {
-                    __node* cv = name->extract_cv(name);
-                    if (__make<__function>(name, __root_))
-                    {
-                        if (cv)
-                        {
-                            cv->__left_ = __root_;
-                            cv->__size_ <<= 5;
-                            __root_ = cv;
-                        }
-                        first = t2;
-                    }
-                }
-            }
-            __tag_templates_ = prev_tag_templates;
-        }
-        else
-            first = t;
-    }
-    else
-        first = __parse_special_name(first, last);
-    return first;
-}
-
-// <mangled-name> ::= _Z<encoding>
-//                ::= <type>
-
-void
-__demangle_tree::__parse()
-{
-    if (__mangled_name_begin_ == __mangled_name_end_)
-    {
-        __status_ = invalid_mangled_name;
-        return;
-    }
-    const char* t = NULL;
-    if (__mangled_name_end_ - __mangled_name_begin_ >= 2 &&
-                         __mangled_name_begin_[0] == '_' &&
-                         __mangled_name_begin_[1] == 'Z')
-    {
-        t = __parse_encoding(__mangled_name_begin_+2, __mangled_name_end_);
-        if (t != __mangled_name_begin_+2 && t != __mangled_name_end_ && *t == '.')
-            t = __parse_dot_suffix(t, __mangled_name_end_);
-    }
-    else
-        t = __parse_type(__mangled_name_begin_, __mangled_name_end_);
-    if (t == __mangled_name_end_ && __root_)
-    {
-        if (__fix_forward_references_)
-        {
-            if (__root_->fix_forward_references(__t_begin_, __t_end_))
-               __status_ = success;
-        }
-        else
-           __status_ = success;
-    }
-}
-
-__demangle_tree
-__demangle(const char* mangled_name, char* buf, size_t bs)
-{
-    __demangle_tree t(mangled_name, buf, bs);
-    if (t.__status() == invalid_mangled_name)
-        t.__parse();
-    return t;
-}
-
-__demangle_tree
-__demangle(const char* mangled_name)
-{
-    return __demangle(mangled_name, 0, 0);
-}
-
-char*
-__demangle(__demangle_tree dmg_tree, char* buf, size_t* n, int* status)
-{
-    if (dmg_tree.__status() != success)
-    {
-        if (status)
-            *status = dmg_tree.__status();
-        return NULL;
-    }
-#ifdef DEBUGGING
-display(dmg_tree.__root_);
-printf("\n");
-#endif
-    const size_t bs = buf == NULL ? 0 : *n;
-    ptrdiff_t sm = dmg_tree.__mangled_name_end_ - dmg_tree.__mangled_name_begin_;
-    ptrdiff_t est = sm + 60 * (
-                                (dmg_tree.__node_end_ - dmg_tree.__node_begin_) +
-                                (dmg_tree.__sub_end_ - dmg_tree.__sub_begin_) +
-                                (dmg_tree.__t_end_ - dmg_tree.__t_begin_));
-    const unsigned N = 4096;
-    char tmp[N];
-    ptrdiff_t s;
-    if (static_cast<size_t>(est) <= bs)
-    {
-        char* e = dmg_tree.__get_demangled_name(buf);
-        *e++ = '\0';
-        s = e - buf;
-    }
-    else if (static_cast<size_t>(est) <= N)
-    {
-        char* e = dmg_tree.__get_demangled_name(tmp);
-        *e++ = '\0';
-        s = e - tmp;
-    }
-    else
-        s = static_cast<ptrdiff_t>(dmg_tree.size() + 1);
-    if (static_cast<size_t>(s) > bs)
-    {
-        buf = static_cast<char*>(realloc(buf, static_cast<size_t>(s)));
-        if (buf == NULL)
-        {
-            if (status)
-                *status = memory_alloc_failure;
-            return NULL;
-        }
-        if (n)
-            *n = static_cast<size_t>(s);
-    }
-    if (static_cast<size_t>(est) > bs)
-    {
-        if (static_cast<size_t>(est) <= N)
-            strncpy(buf, tmp, static_cast<size_t>(s));
-        else
-            *dmg_tree.__get_demangled_name(buf) = '\0';
-    }
-    if (status)
-        *status = success;
-    return buf;
-}
-
-}  // __libcxxabi
-
-#pragma GCC visibility pop
-#pragma GCC visibility push(default)
-
-//extern "C"
-//{
-
-char*
-__cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status)
-{
-    if (mangled_name == NULL || (buf != NULL && n == NULL))
-    {
-        if (status)
-            *status = __libcxxabi::invalid_args;
-        return NULL;
-    }
-    const size_t bs = 4 * 1024;
-    __attribute((aligned(16))) char static_buf[bs];
-
-    buf = __libcxxabi::__demangle(__libcxxabi::__demangle(mangled_name,
-                                                          static_buf, bs),
-                                  buf, n, status);
-    return buf;
-}
-
-//}  // extern "C"
-
-}  // lldb_cxxabiv1

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp Wed Jul 17 17:17:41 2013
@@ -518,12 +518,13 @@ lldb_private::formatters::WCharStringSum
     if (data_addr == 0 || data_addr == LLDB_INVALID_ADDRESS)
         return false;
 
-    clang::ASTContext* ast = valobj.GetClangAST();
-
+    clang::ASTContext* ast = valobj.GetClangType().GetASTContext();
+    
     if (!ast)
         return false;
 
-    uint32_t wchar_size = ClangASTType::GetClangTypeBitWidth(ast, ClangASTType::GetBasicType(ast, lldb::eBasicTypeWChar).GetOpaqueQualType());
+    ClangASTType wchar_clang_type = ClangASTContext::GetBasicType(ast, lldb::eBasicTypeWChar);
+    const uint32_t wchar_size = wchar_clang_type.GetBitSize();
 
     switch (wchar_size)
     {
@@ -605,15 +606,15 @@ lldb_private::formatters::WCharSummaryPr
     DataExtractor data;
     valobj.GetData(data);
     
-    clang::ASTContext* ast = valobj.GetClangAST();
+    clang::ASTContext* ast = valobj.GetClangType().GetASTContext();
     
     if (!ast)
         return false;
     
+    ClangASTType wchar_clang_type = ClangASTContext::GetBasicType(ast, lldb::eBasicTypeWChar);
+    const uint32_t wchar_size = wchar_clang_type.GetBitSize();
     std::string value;
     
-    uint32_t wchar_size = ClangASTType::GetClangTypeBitWidth(ast, ClangASTType::GetBasicType(ast, lldb::eBasicTypeWChar).GetOpaqueQualType());
-    
     switch (wchar_size)
     {
         case 8:
@@ -1133,13 +1134,13 @@ lldb_private::formatters::NSAttributedSt
     if (!target_sp)
         return false;
     uint32_t addr_size = target_sp->GetArchitecture().GetAddressByteSize();
-    uint64_t pointee = valobj.GetValueAsUnsigned(0);
-    if (!pointee)
+    uint64_t pointer_value = valobj.GetValueAsUnsigned(0);
+    if (!pointer_value)
         return false;
-    pointee += addr_size;
-    ClangASTType type(valobj.GetClangAST(),valobj.GetClangType());
+    pointer_value += addr_size;
+    ClangASTType type(valobj.GetClangType());
     ExecutionContext exe_ctx(target_sp,false);
-    ValueObjectSP child_ptr_sp(valobj.CreateValueObjectFromAddress("string_ptr", pointee, exe_ctx, type));
+    ValueObjectSP child_ptr_sp(valobj.CreateValueObjectFromAddress("string_ptr", pointer_value, exe_ctx, type));
     if (!child_ptr_sp)
         return false;
     DataExtractor data;
@@ -1167,20 +1168,18 @@ lldb_private::formatters::RuntimeSpecifi
 bool
 lldb_private::formatters::ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream)
 {
-    const uint32_t type_info = ClangASTContext::GetTypeInfo(valobj.GetClangType(),
-                                                            valobj.GetClangAST(),
-                                                            NULL);
+    const uint32_t type_info = valobj.GetClangType().GetTypeInfo();
     
     ValueObjectSP real_guy_sp = valobj.GetSP();
     
-    if (type_info & ClangASTContext::eTypeIsPointer)
+    if (type_info & ClangASTType::eTypeIsPointer)
     {
         Error err;
         real_guy_sp = valobj.Dereference(err);
         if (err.Fail() || !real_guy_sp)
             return false;
     }
-    else if (type_info & ClangASTContext::eTypeIsReference)
+    else if (type_info & ClangASTType::eTypeIsReference)
     {
         real_guy_sp =  valobj.GetChildAtIndex(0, true);
         if (!real_guy_sp)
@@ -1202,12 +1201,10 @@ lldb_private::formatters::ObjCSELSummary
 {
     lldb::ValueObjectSP valobj_sp;
 
-    if (!valobj.GetClangAST())
-        return false;
-    void* char_opaque_type = valobj.GetClangAST()->CharTy.getAsOpaquePtr();
-    if (!char_opaque_type)
+    ClangASTType charstar (valobj.GetClangType().GetBasicTypeFromAST(eBasicTypeChar).GetPointerType());
+    
+    if (!charstar)
         return false;
-    ClangASTType charstar(valobj.GetClangAST(),ClangASTType::GetPointerType(valobj.GetClangAST(), char_opaque_type));
 
     ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
     
@@ -1303,7 +1300,7 @@ lldb_private::formatters::VectorIterator
         return false;
     Error err;
     m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    m_item_sp = ValueObject::CreateValueObjectFromAddress("item", item_ptr->GetValueAsUnsigned(0), m_exe_ctx_ref, ClangASTType(item_ptr->GetClangAST(),ClangASTType::GetPointeeType(item_ptr->GetClangType())));
+    m_item_sp = ValueObject::CreateValueObjectFromAddress("item", item_ptr->GetValueAsUnsigned(0), m_exe_ctx_ref, item_ptr->GetClangType().GetPointeeType());
     if (err.Fail())
         m_item_sp.reset();
     return false;

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/Cocoa.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/Cocoa.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/Cocoa.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/Cocoa.cpp Wed Jul 17 17:17:41 2013
@@ -57,8 +57,7 @@ lldb_private::formatters::NSBundleSummar
     if (!strcmp(class_name,"NSBundle"))
     {
         uint64_t offset = 5 * ptr_size;
-        ClangASTType type(valobj.GetClangAST(),ClangASTContext::GetBuiltInType_objc_id(valobj.GetClangAST()));
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, type, true));
+        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, valobj.GetClangType().GetBasicTypeFromAST(lldb::eBasicTypeObjCID), true));
 
         StreamString summary_stream;
         bool was_nsstring_ok = NSStringSummaryProvider(*text.get(), summary_stream);
@@ -105,8 +104,7 @@ lldb_private::formatters::NSTimeZoneSumm
     if (!strcmp(class_name,"__NSTimeZone"))
     {
         uint64_t offset = ptr_size;
-        ClangASTType type(valobj.GetClangAST(),valobj.GetClangType());
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, type, true));
+        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, valobj.GetClangType(), true));
         StreamString summary_stream;
         bool was_nsstring_ok = NSStringSummaryProvider(*text.get(), summary_stream);
         if (was_nsstring_ok && summary_stream.GetSize() > 0)
@@ -150,8 +148,7 @@ lldb_private::formatters::NSNotification
     if (!strcmp(class_name,"NSConcreteNotification"))
     {
         uint64_t offset = ptr_size;
-        ClangASTType type(valobj.GetClangAST(),valobj.GetClangType());
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, type, true));
+        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, valobj.GetClangType(), true));
         StreamString summary_stream;
         bool was_nsstring_ok = NSStringSummaryProvider(*text.get(), summary_stream);
         if (was_nsstring_ok && summary_stream.GetSize() > 0)
@@ -450,7 +447,7 @@ lldb_private::formatters::NSURLSummaryPr
     {
         uint64_t offset_text = ptr_size + ptr_size + 8; // ISA + pointer + 8 bytes of data (even on 32bit)
         uint64_t offset_base = offset_text + ptr_size;
-        ClangASTType type(valobj.GetClangAST(),valobj.GetClangType());
+        ClangASTType type(valobj.GetClangType());
         ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, true));
         ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, true));
         if (!text)

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp Wed Jul 17 17:17:41 2013
@@ -774,6 +774,13 @@ FormatManager::LoadObjCFormatters()
 #endif // LLDB_DISABLE_PYTHON
 
     objc_flags.SetSkipPointers(false);
+    objc_flags.SetCascades(true);
+    objc_flags.SetSkipReferences(false);
+    
+    AddStringSummary (objc_category_sp,
+                      "${var.__FuncPtr%A}",
+                      ConstString("__block_literal_generic"),
+                      objc_flags);
 
     TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);
 

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/LibCxx.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/LibCxx.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/LibCxx.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/LibCxx.cpp Wed Jul 17 17:17:41 2013
@@ -330,7 +330,7 @@ lldb_private::formatters::LibcxxSharedPt
                 return lldb::ValueObjectSP();
             uint64_t count = 1 + shared_owners_sp->GetValueAsUnsigned(0);
             DataExtractor data(&count, 8, m_byte_order, m_ptr_size);
-            m_count_sp = ValueObject::CreateValueObjectFromData("count", data, valobj_sp->GetExecutionContextRef(), ClangASTType(shared_owners_sp->GetClangAST(), shared_owners_sp->GetClangType()));
+            m_count_sp = ValueObject::CreateValueObjectFromData("count", data, valobj_sp->GetExecutionContextRef(), shared_owners_sp->GetClangType());
         }
         return m_count_sp;
     }
@@ -343,7 +343,7 @@ lldb_private::formatters::LibcxxSharedPt
                 return lldb::ValueObjectSP();
             uint64_t count = 1 + shared_weak_owners_sp->GetValueAsUnsigned(0);
             DataExtractor data(&count, 8, m_byte_order, m_ptr_size);
-            m_weak_count_sp = ValueObject::CreateValueObjectFromData("count", data, valobj_sp->GetExecutionContextRef(), ClangASTType(shared_weak_owners_sp->GetClangAST(), shared_weak_owners_sp->GetClangType()));
+            m_weak_count_sp = ValueObject::CreateValueObjectFromData("count", data, valobj_sp->GetExecutionContextRef(), shared_weak_owners_sp->GetClangType());
         }
         return m_weak_count_sp;
     }
@@ -464,9 +464,8 @@ lldb_private::formatters::LibcxxStdVecto
     data_type_finder_sp = data_type_finder_sp->GetChildMemberWithName(ConstString("__first_"),true);
     if (!data_type_finder_sp)
         return false;
-    m_element_type = ClangASTType(data_type_finder_sp->GetClangAST(),data_type_finder_sp->GetClangType());
-    m_element_type.SetClangType(m_element_type.GetASTContext(), m_element_type.GetPointeeType());
-    m_element_size = m_element_type.GetTypeByteSize();
+    m_element_type = data_type_finder_sp->GetClangType().GetPointeeType();
+    m_element_size = m_element_type.GetByteSize();
     
     if (m_element_size > 0)
     {

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxList.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxList.cpp Wed Jul 17 17:17:41 2013
@@ -272,16 +272,14 @@ lldb_private::formatters::LibcxxStdListS
     ValueObjectSP impl_sp(m_backend.GetChildMemberWithName(ConstString("__end_"),true));
     if (!impl_sp)
         return false;
-    auto list_type = m_backend.GetClangType();
-    if (ClangASTContext::IsReferenceType(list_type))
-    {
-        clang::QualType qt = clang::QualType::getFromOpaquePtr(list_type);
-        list_type = qt.getNonReferenceType().getAsOpaquePtr();
-    }
-    if (ClangASTContext::GetNumTemplateArguments(m_backend.GetClangAST(), list_type) == 0)
+    ClangASTType list_type = m_backend.GetClangType();
+    if (list_type.IsReferenceType())
+        list_type = list_type.GetNonReferenceType();
+
+    if (list_type.GetNumTemplateArguments() == 0)
         return false;
     lldb::TemplateArgumentKind kind;
-    m_element_type = ClangASTType(m_backend.GetClangAST(), ClangASTContext::GetTemplateArgument(m_backend.GetClangAST(), list_type, 0, kind));
+    m_element_type = list_type.GetTemplateArgument(0, kind);
     m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
     m_tail = impl_sp->GetChildMemberWithName(ConstString("__prev_"), true).get();
     return false;

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxMap.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxMap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/LibCxxMap.cpp Wed Jul 17 17:17:41 2013
@@ -281,7 +281,7 @@ lldb_private::formatters::LibcxxStdMapSy
     deref = deref->GetChildMemberWithName(ConstString("__value_"), true);
     if (!deref)
         return false;
-    m_element_type.SetClangType(deref->GetClangAST(), deref->GetClangType());
+    m_element_type = deref->GetClangType();
     return true;
 }
 
@@ -292,9 +292,9 @@ lldb_private::formatters::LibcxxStdMapSy
         return;
     if (!node)
         return;
-    ClangASTType node_type(node->GetClangAST(),node->GetClangType());
+    ClangASTType node_type(node->GetClangType());
     uint64_t bit_offset;
-    if (ClangASTContext::GetIndexOfFieldWithName(node->GetClangAST(),node->GetClangType(),"__value_",NULL,&bit_offset) == UINT32_MAX)
+    if (node_type.GetIndexOfFieldWithName("__value_", NULL, &bit_offset) == UINT32_MAX)
         return;
     m_skip_size = bit_offset / 8u;
 }

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/LibStdcpp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/LibStdcpp.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/LibStdcpp.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/LibStdcpp.cpp Wed Jul 17 17:17:41 2013
@@ -206,12 +206,12 @@ lldb_private::formatters::LibstdcppVecto
  */
 
 lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-SyntheticChildrenFrontEnd(*valobj_sp.get()),
-m_exe_ctx_ref(),
-m_pair_address(0),
-m_pair_type(),
-m_options(),
-m_pair_sp()
+    SyntheticChildrenFrontEnd(*valobj_sp.get()),
+    m_exe_ctx_ref(),
+    m_pair_address(0),
+    m_pair_type(),
+    m_options(),
+    m_pair_sp()
 {
     if (valobj_sp)
         Update();
@@ -249,14 +249,14 @@ lldb_private::formatters::LibstdcppMapIt
     
     m_pair_address += (is_64bit ? 32 : 16);
     
-    ClangASTType my_type(valobj_sp->GetClangAST(),valobj_sp->GetClangType());
-    if (ClangASTContext::GetNumTemplateArguments(valobj_sp->GetClangAST(),valobj_sp->GetClangType()) >= 1)
+    ClangASTType my_type(valobj_sp->GetClangType());
+    if (my_type.GetNumTemplateArguments() >= 1)
     {
         TemplateArgumentKind kind;
-        clang_type_t pair_type = ClangASTContext::GetTemplateArgument(valobj_sp->GetClangAST(),valobj_sp->GetClangType(), 0, kind);
+        ClangASTType pair_type = my_type.GetTemplateArgument(0, kind);
         if (kind != eTemplateArgumentKindType && kind != eTemplateArgumentKindTemplate && kind != eTemplateArgumentKindTemplateExpansion)
             return false;
-        m_pair_type = ClangASTType(valobj_sp->GetClangAST(),pair_type);
+        m_pair_type = pair_type;
     }
     else
         return false;
@@ -273,15 +273,13 @@ lldb_private::formatters::LibstdcppMapIt
 lldb::ValueObjectSP
 lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::GetChildAtIndex (size_t idx)
 {
-    if (m_pair_address == 0)
-        return lldb::ValueObjectSP();
-    if (m_pair_type.GetASTContext() == NULL ||
-        m_pair_type.GetOpaqueQualType() == NULL)
-        return lldb::ValueObjectSP();
-    if (!m_pair_sp)
-        m_pair_sp = ValueObject::CreateValueObjectFromAddress("pair", m_pair_address, m_exe_ctx_ref, m_pair_type);
-    if (m_pair_sp)
-        return m_pair_sp->GetChildAtIndex(idx, true);
+    if (m_pair_address != 0 && m_pair_type)
+    {
+        if (!m_pair_sp)
+            m_pair_sp = ValueObject::CreateValueObjectFromAddress("pair", m_pair_address, m_exe_ctx_ref, m_pair_type);
+        if (m_pair_sp)
+            return m_pair_sp->GetChildAtIndex(idx, true);
+    }
     return lldb::ValueObjectSP();
 }
 

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/NSArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/NSArray.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/NSArray.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/NSArray.cpp Wed Jul 17 17:17:41 2013
@@ -90,14 +90,18 @@ lldb_private::formatters::NSArraySummary
 }
 
 lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-SyntheticChildrenFrontEnd(*valobj_sp.get()),
-m_exe_ctx_ref(),
-m_ptr_size(8),
-m_data_32(NULL),
-m_data_64(NULL)
+    SyntheticChildrenFrontEnd(*valobj_sp.get()),
+    m_exe_ctx_ref(),
+    m_ptr_size(8),
+    m_data_32(NULL),
+    m_data_64(NULL)
 {
     if (valobj_sp)
-        m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
+    {
+        clang::ASTContext *ast = valobj_sp->GetClangType().GetASTContext();
+        if (ast)
+            m_id_type = ClangASTType(ast, ast->ObjCBuiltinIdTy);
+    }
 }
 
 size_t
@@ -195,14 +199,18 @@ lldb_private::formatters::NSArrayMSynthe
 }
 
 lldb_private::formatters::NSArrayISyntheticFrontEnd::NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-SyntheticChildrenFrontEnd(*valobj_sp.get()),
-m_exe_ctx_ref(),
-m_ptr_size(8),
-m_items(0),
-m_data_ptr(0)
+    SyntheticChildrenFrontEnd (*valobj_sp.get()),
+    m_exe_ctx_ref (),
+    m_ptr_size (8),
+    m_items (0),
+    m_data_ptr (0)
 {
     if (valobj_sp)
-        m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
+    {
+        clang::ASTContext *ast = valobj_sp->GetClangType().GetASTContext();
+        if (ast)
+            m_id_type = ClangASTType(ast, ast->ObjCBuiltinIdTy);
+    }
 }
 
 lldb_private::formatters::NSArrayISyntheticFrontEnd::~NSArrayISyntheticFrontEnd ()

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/NSDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/NSDictionary.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/NSDictionary.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/NSDictionary.cpp Wed Jul 17 17:17:41 2013
@@ -30,52 +30,52 @@ using namespace lldb_private::formatters
 static ClangASTType
 GetLLDBNSPairType (TargetSP target_sp)
 {
-    ClangASTType clang_type = ClangASTType();
+    ClangASTType clang_type;
 
     ClangASTContext *target_ast_context = target_sp->GetScratchClangASTContext();
 
-    if (!target_ast_context)
-        return clang_type;
-    
-    const char* type_name = "__lldb_autogen_nspair";
-    
-    clang::IdentifierInfo &myIdent = target_ast_context->getASTContext()->Idents.get(type_name);
-    clang::DeclarationName myName = target_ast_context->getASTContext()->DeclarationNames.getIdentifier(&myIdent);
-
-    clang::DeclContext::lookup_const_result result = target_ast_context->getASTContext()->getTranslationUnitDecl()->lookup(myName);
-
-    clang_type_t opaque_type = NULL;
-    
-    for (clang::NamedDecl *named_decl : result)
+    if (target_ast_context)
     {
-        if (const clang::CXXRecordDecl *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(named_decl))
-        {
-            opaque_type = clang::QualType(record_decl->getTypeForDecl(), 0).getAsOpaquePtr();
-            break;
-        }
-        else
+        clang::ASTContext *ast = target_ast_context->getASTContext();
+
+        if (ast)
         {
-            // somebody else (the user?) has defined a type with the magic name already - fail!!!
-            return clang_type;
+            const char* type_name = "__lldb_autogen_nspair";
+            
+            clang::IdentifierInfo &myIdent = ast->Idents.get(type_name);
+            clang::DeclarationName myName = ast->DeclarationNames.getIdentifier(&myIdent);
+
+            clang::DeclContext::lookup_const_result result = ast->getTranslationUnitDecl()->lookup(myName);
+
+            for (clang::NamedDecl *named_decl : result)
+            {
+                if (const clang::CXXRecordDecl *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(named_decl))
+                {
+                    clang_type.SetClangType(ast, clang::QualType(record_decl->getTypeForDecl(), 0));
+                    break;
+                }
+                else
+                {
+                    // somebody else (the user?) has defined a type with the magic name already - fail!!!
+                    return clang_type;
+                }
+            }
+
+            if (!clang_type)
+            {
+                clang_type = target_ast_context->CreateRecordType(NULL, lldb::eAccessPublic, type_name, clang::TTK_Struct, lldb::eLanguageTypeC);
+                
+                if (clang_type)
+                {
+                    clang_type.StartTagDeclarationDefinition();
+                    ClangASTType id_clang_type = target_ast_context->GetBasicType (eBasicTypeObjCID);
+                    clang_type.AddFieldToRecordType("key", id_clang_type, lldb::eAccessPublic, 0);
+                    clang_type.AddFieldToRecordType("value", id_clang_type, lldb::eAccessPublic, 0);
+                    clang_type.CompleteTagDeclarationDefinition();
+                }
+            }
         }
     }
-
-    if (!opaque_type)
-    {
-        opaque_type = target_ast_context->CreateRecordType(NULL, lldb::eAccessPublic, type_name, clang::TTK_Struct, lldb::eLanguageTypeC);
-        
-        if (!opaque_type)
-            return clang_type;
-        
-        target_ast_context->StartTagDeclarationDefinition(opaque_type);
-        
-        target_ast_context->AddFieldToRecordType(opaque_type, "key", target_ast_context->GetBuiltInType_objc_id(), lldb::eAccessPublic, 0);
-        target_ast_context->AddFieldToRecordType(opaque_type, "value", target_ast_context->GetBuiltInType_objc_id(), lldb::eAccessPublic, 0);
-        
-        target_ast_context->CompleteTagDeclarationDefinition(opaque_type);
-    }
-    
-    clang_type.SetClangType(target_ast_context->getASTContext(), opaque_type);
     return clang_type;
 }
 

Modified: lldb/branches/lldb-platform-work/source/DataFormatters/NSSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/NSSet.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/NSSet.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/NSSet.cpp Wed Jul 17 17:17:41 2013
@@ -74,7 +74,7 @@ lldb_private::formatters::NSSetSummaryPr
             return false;
         value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
     }
-    else if (!strcmp(class_name,"__NSCFSet"))
+    /*else if (!strcmp(class_name,"__NSCFSet"))
     {
         Error error;
         value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ? 20 : 12), 4, 0, error);
@@ -83,7 +83,7 @@ lldb_private::formatters::NSSetSummaryPr
         if (is_64bit)
             value &= ~0x1fff000000000000UL;
     }
-    /*else if (!strcmp(class_name,"NSCountedSet"))
+    else if (!strcmp(class_name,"NSCountedSet"))
     {
         Error error;
         value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);

Modified: lldb/branches/lldb-platform-work/source/Expression/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ASTDumper.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ASTDumper.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ASTDumper.cpp Wed Jul 17 17:17:41 2013
@@ -9,6 +9,7 @@
 
 #include "lldb/Core/Log.h"
 #include "lldb/Expression/ASTDumper.h"
+#include "lldb/Symbol/ClangASTType.h"
 
 #include "llvm/Support/raw_ostream.h"
 
@@ -77,7 +78,13 @@ ASTDumper::ASTDumper (lldb::clang_type_t
 {
     m_dump = clang::QualType::getFromOpaquePtr(type).getAsString();
 }
-    
+
+ASTDumper::ASTDumper (const ClangASTType &clang_type)
+{
+    m_dump = clang_type.GetQualType().getAsString();
+}
+
+
 const char *
 ASTDumper::GetCString()
 {

Modified: lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp Wed Jul 17 17:17:41 2013
@@ -238,12 +238,12 @@ ClangASTSource::CompleteType (TagDecl *t
                     if (!type)
                         continue;
                     
-                    lldb::clang_type_t opaque_type = type->GetClangFullType();
+                    ClangASTType clang_type (type->GetClangFullType());
                     
-                    if (!opaque_type)
+                    if (!clang_type)
                         continue;
                     
-                    const TagType *tag_type = QualType::getFromOpaquePtr(opaque_type)->getAs<TagType>();
+                    const TagType *tag_type = clang_type.GetQualType()->getAs<TagType>();
                     
                     if (!tag_type)
                         continue;
@@ -277,12 +277,12 @@ ClangASTSource::CompleteType (TagDecl *t
                 if (!type)
                     continue;
                 
-                lldb::clang_type_t opaque_type = type->GetClangFullType();
+                ClangASTType clang_type (type->GetClangFullType());
                 
-                if (!opaque_type)
+                if (!clang_type)
                     continue;
                 
-                const TagType *tag_type = QualType::getFromOpaquePtr(opaque_type)->getAs<TagType>();
+                const TagType *tag_type = clang_type.GetQualType()->getAs<TagType>();
                 
                 if (!tag_type)
                     continue;
@@ -346,7 +346,7 @@ ClangASTSource::GetCompleteObjCInterface
     if (!complete_type_sp)
         return NULL;
     
-    TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetClangFullType(), complete_type_sp->GetClangAST());
+    TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetClangFullType());
     lldb::clang_type_t complete_opaque_type = complete_type.GetOpaqueQualType();
     
     if (!complete_opaque_type)
@@ -696,12 +696,11 @@ ClangASTSource::FindExternalVisibleDecls
                             (name_string ? name_string : "<anonymous>"));
             }
                         
-            clang::ASTContext *type_ast = type_sp->GetClangAST();
-            lldb::clang_type_t full_type = type_sp->GetClangFullType();
+            ClangASTType full_type = type_sp->GetClangFullType();
 
-            void *copied_type = GuardedCopyType(m_ast_context, type_ast, full_type);
+            ClangASTType copied_clang_type (GuardedCopyType(full_type));
                 
-            if (!copied_type)
+            if (!copied_clang_type)
             {                
                 if (log)
                     log->Printf("  CAS::FEVD[%u] - Couldn't export a type",
@@ -710,7 +709,7 @@ ClangASTSource::FindExternalVisibleDecls
                 break;
             }
                 
-            context.AddTypeDecl(copied_type);
+            context.AddTypeDecl(copied_clang_type);
         }
         else
         {
@@ -750,13 +749,9 @@ ClangASTSource::FindExternalVisibleDecls
                                 name.GetCString());
                 }
                 
-                const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr();
+                ClangASTType copied_clang_type (GuardedCopyType(types[0]));
                 
-                clang::QualType runtime_qual_type(runtime_clang_type, 0);
-                
-                void *copied_type = GuardedCopyType(m_ast_context, type_vendor->GetClangASTContext(), runtime_qual_type.getAsOpaquePtr());
-                
-                if (!copied_type)
+                if (!copied_clang_type)
                 {
                     if (log)
                         log->Printf("  CAS::FEVD[%u] - Couldn't export a type from the runtime",
@@ -765,7 +760,7 @@ ClangASTSource::FindExternalVisibleDecls
                     break;
                 }
                 
-                context.AddTypeDecl(copied_type);
+                context.AddTypeDecl(copied_clang_type);
             }
             while(0);
         }
@@ -1688,42 +1683,43 @@ ClangASTSource::AddNamespace (NameSearch
     return dyn_cast<NamespaceDecl>(copied_decl);
 }
 
-void * 
-ClangASTSource::GuardedCopyType (ASTContext *dest_context, 
-                                 ASTContext *source_context,
-                                 void *clang_type)
+ClangASTType
+ClangASTSource::GuardedCopyType (const ClangASTType &src_type)
 {
     ClangASTMetrics::RegisterLLDBImport();
     
     SetImportInProgress(true);
     
-    QualType ret_qual_type = m_ast_importer->CopyType (m_ast_context, source_context, QualType::getFromOpaquePtr(clang_type));
-    
-    void *ret = ret_qual_type.getAsOpaquePtr();
+    QualType copied_qual_type = m_ast_importer->CopyType (m_ast_context, src_type.GetASTContext(), src_type.GetQualType());
     
     SetImportInProgress(false);
     
-    if (ret && ret_qual_type->getCanonicalTypeInternal().isNull())
+    if (copied_qual_type.getAsOpaquePtr() && copied_qual_type->getCanonicalTypeInternal().isNull())
         // this shouldn't happen, but we're hardening because the AST importer seems to be generating bad types
         // on occasion.
-        return NULL;
+        return ClangASTType();
     
-    return ret;
+    return ClangASTType(m_ast_context, copied_qual_type);
 }
 
 clang::NamedDecl *
-NameSearchContext::AddVarDecl(void *type) 
+NameSearchContext::AddVarDecl(const ClangASTType &type)
 {
+    assert (type && "Type for variable must be valid!");
+
+    if (!type.IsValid())
+        return NULL;
+    
     IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo();
     
-    assert (type && "Type for variable must be non-NULL!");
-        
-    clang::NamedDecl *Decl = VarDecl::Create(*m_ast_source.m_ast_context, 
+    clang::ASTContext *ast = type.GetASTContext();
+
+    clang::NamedDecl *Decl = VarDecl::Create(*ast,
                                              const_cast<DeclContext*>(m_decl_context), 
                                              SourceLocation(), 
                                              SourceLocation(),
                                              ii, 
-                                             QualType::getFromOpaquePtr(type), 
+                                             type.GetQualType(),
                                              0, 
                                              SC_Static);
     m_decls.push_back(Decl);
@@ -1732,25 +1728,32 @@ NameSearchContext::AddVarDecl(void *type
 }
 
 clang::NamedDecl *
-NameSearchContext::AddFunDecl (void *type) 
+NameSearchContext::AddFunDecl (const ClangASTType &type) 
 {
-    assert (type && "Type for variable must be non-NULL!");
+    assert (type && "Type for variable must be valid!");
     
+    if (!type.IsValid())
+        return NULL;
+
     if (m_function_types.count(type))
         return NULL;
     
     m_function_types.insert(type);
     
+    QualType qual_type (type.GetQualType());
+    
+    clang::ASTContext *ast = type.GetASTContext();
+
     const bool isInlineSpecified = false;
     const bool hasWrittenPrototype = true;
     const bool isConstexprSpecified = false;
 
-    clang::FunctionDecl *func_decl = FunctionDecl::Create (*m_ast_source.m_ast_context,
+    clang::FunctionDecl *func_decl = FunctionDecl::Create (*ast,
                                                            const_cast<DeclContext*>(m_decl_context),
                                                            SourceLocation(),
                                                            SourceLocation(),
                                                            m_decl_name.getAsIdentifierInfo(),
-                                                           QualType::getFromOpaquePtr(type),
+                                                           qual_type,
                                                            NULL,
                                                            SC_Static,
                                                            isInlineSpecified,
@@ -1761,7 +1764,6 @@ NameSearchContext::AddFunDecl (void *typ
     // synthesize ParmVarDecls for all of the FunctionDecl's arguments.  To do
     // this, we raid the function's FunctionProtoType for types.
     
-    QualType qual_type (QualType::getFromOpaquePtr(type));
     const FunctionProtoType *func_proto_type = qual_type.getTypePtr()->getAs<FunctionProtoType>();
     
     if (func_proto_type)
@@ -1775,7 +1777,7 @@ NameSearchContext::AddFunDecl (void *typ
         {
             QualType arg_qual_type (func_proto_type->getArgType(ArgIndex));
             
-            parm_var_decls.push_back(ParmVarDecl::Create (*m_ast_source.m_ast_context,
+            parm_var_decls.push_back(ParmVarDecl::Create (*ast,
                                                           const_cast<DeclContext*>(m_decl_context),
                                                           SourceLocation(),
                                                           SourceLocation(),
@@ -1812,15 +1814,15 @@ NameSearchContext::AddGenericFunDecl()
                                                                                 ArrayRef<QualType>(),                                        // argument types
                                                                                 proto_info));
     
-    return AddFunDecl(generic_function_type.getAsOpaquePtr());
+    return AddFunDecl(ClangASTType (m_ast_source.m_ast_context, generic_function_type));
 }
 
 clang::NamedDecl *
-NameSearchContext::AddTypeDecl(void *type)
+NameSearchContext::AddTypeDecl(const ClangASTType &clang_type)
 {
-    if (type)
+    if (clang_type)
     {
-        QualType qual_type = QualType::getFromOpaquePtr(type);
+        QualType qual_type = clang_type.GetQualType();
 
         if (const TypedefType *typedef_type = llvm::dyn_cast<TypedefType>(qual_type))
         {

Modified: lldb/branches/lldb-platform-work/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangExpressionDeclMap.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangExpressionDeclMap.cpp Wed Jul 17 17:17:41 2013
@@ -128,14 +128,7 @@ ClangExpressionDeclMap::DidParse()
         {
             ClangExpressionVariableSP var_sp(m_found_entities.GetVariableAtIndex(entity_index));
             if (var_sp)
-            {
-                ClangExpressionVariable::ParserVars *parser_vars = var_sp->GetParserVars(GetParserID());
-                
-                if (parser_vars && parser_vars->m_lldb_value)
-                    delete parser_vars->m_lldb_value;
-            
                 var_sp->DisableParserVars(GetParserID());
-            }
         }
         
         for (size_t pvar_index = 0, num_pvars = m_parser_vars->m_persistent_vars->GetSize();
@@ -211,13 +204,11 @@ ClangExpressionDeclMap::AddPersistentVar
         
         uint32_t offset = m_parser_vars->m_materializer->AddResultVariable(user_type, is_lvalue, m_keep_result_in_memory, err);
         
-        m_found_entities.CreateVariable(exe_ctx.GetBestExecutionContextScope(),
-                                        name,
-                                        user_type,
-                                        m_parser_vars->m_target_info.byte_order,
-                                        m_parser_vars->m_target_info.address_byte_size);
-        
-        ClangExpressionVariableSP var_sp (m_found_entities.GetVariable(name));
+        ClangExpressionVariableSP var_sp = m_found_entities.CreateVariable(exe_ctx.GetBestExecutionContextScope(),
+                                                                           name,
+                                                                           user_type,
+                                                                           m_parser_vars->m_target_info.byte_order,
+                                                                           m_parser_vars->m_target_info.address_byte_size);
         
         if (!var_sp)
             return false;
@@ -261,14 +252,11 @@ ClangExpressionDeclMap::AddPersistentVar
     if (!m_parser_vars->m_target_info.IsValid())
         return false;
     
-    if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx.GetBestExecutionContextScope (),
-                                                                     name, 
-                                                                     user_type, 
-                                                                     m_parser_vars->m_target_info.byte_order,
-                                                                     m_parser_vars->m_target_info.address_byte_size))
-        return false;
-    
-    ClangExpressionVariableSP var_sp (m_parser_vars->m_persistent_vars->GetVariable(name));
+    ClangExpressionVariableSP var_sp = m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx.GetBestExecutionContextScope (),
+                                                                                                   name,
+                                                                                                   user_type,
+                                                                                                   m_parser_vars->m_target_info.byte_order,
+                                                                                                   m_parser_vars->m_target_info.address_byte_size);
     
     if (!var_sp)
         return false;
@@ -495,7 +483,7 @@ ClangExpressionDeclMap::GetFunctionInfo
     
     ClangExpressionVariable::ParserVars *parser_vars = entity_sp->GetParserVars(GetParserID());
 
-    ptr = parser_vars->m_lldb_value->GetScalar().ULongLong();
+    ptr = parser_vars->m_lldb_value.GetScalar().ULongLong();
     
     return true;
 }
@@ -784,11 +772,8 @@ ClangExpressionDeclMap::FindGlobalVariab
             {
                 VariableSP var_sp = vars.GetVariableAtIndex(i);
                 
-                if (type->GetASTContext() == var_sp->GetType()->GetClangAST())
-                {
-                    if (ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var_sp->GetType()->GetClangFullType()))
-                        return var_sp;
-                }
+                if (ClangASTContext::AreTypesSame(*type, var_sp->GetType()->GetClangFullType()))
+                    return var_sp;
             }
         }
         else
@@ -1009,30 +994,21 @@ ClangExpressionDeclMap::FindExternalVisi
                     if (!this_type)
                         return;
                     
-                    QualType this_qual_type = QualType::getFromOpaquePtr(this_type->GetClangFullType());
-                    const PointerType *class_pointer_type = this_qual_type->getAs<PointerType>();
+                    ClangASTType pointee_type = this_type->GetClangForwardType().GetPointeeType();
                     
-                    if (class_pointer_type)
+                    if (pointee_type.IsValid())
                     {
-                        QualType class_type = class_pointer_type->getPointeeType();
-                        
-                        if (!class_type.getAsOpaquePtr())
-                            return;
-                        
                         if (log)
                         {
                             ASTDumper ast_dumper(this_type->GetClangFullType());
                             log->Printf("  FEVD[%u] Adding type for $__lldb_objc_class: %s", current_id, ast_dumper.GetCString());
                         }
                         
-                        TypeFromUser class_user_type (class_type.getAsOpaquePtr(),
-                                                        this_type->GetClangAST());
+                        TypeFromUser class_user_type(pointee_type);
                         AddOneType(context, class_user_type, current_id);
                                     
                                     
-                        TypeFromUser this_user_type(this_type->GetClangFullType(),
-                                                    this_type->GetClangAST());
-                        
+                        TypeFromUser this_user_type(this_type->GetClangFullType());
                         m_struct_vars->m_object_pointer_type = this_user_type;
                         return;
                     }
@@ -1135,19 +1111,17 @@ ClangExpressionDeclMap::FindExternalVisi
                     if (!self_type)
                         return;
                     
-                    QualType self_qual_type = QualType::getFromOpaquePtr(self_type->GetClangFullType());
+                    ClangASTType self_clang_type = self_type->GetClangFullType();
                     
-                    if (self_qual_type->isObjCClassType())
+                    if (self_clang_type.IsObjCClassType())
                     {
                         return;
                     }
-                    else if (self_qual_type->isObjCObjectPointerType())
+                    else if (self_clang_type.IsObjCObjectPointerType())
                     {
-                        const ObjCObjectPointerType *class_pointer_type = self_qual_type->getAs<ObjCObjectPointerType>();
-                    
-                        QualType class_type = class_pointer_type->getPointeeType();
-                        
-                        if (!class_type.getAsOpaquePtr())
+                        self_clang_type = self_clang_type.GetPointeeType();
+
+                        if (!self_clang_type)
                             return;
                         
                         if (log)
@@ -1156,13 +1130,11 @@ ClangExpressionDeclMap::FindExternalVisi
                             log->Printf("  FEVD[%u] Adding type for $__lldb_objc_class: %s", current_id, ast_dumper.GetCString());
                         }
                         
-                        TypeFromUser class_user_type (class_type.getAsOpaquePtr(),
-                                                      self_type->GetClangAST());
+                        TypeFromUser class_user_type (self_clang_type);
                         
                         AddOneType(context, class_user_type, current_id);
                                     
-                        TypeFromUser self_user_type(self_type->GetClangFullType(),
-                                                    self_type->GetClangAST());
+                        TypeFromUser self_user_type(self_type->GetClangFullType());
                         
                         m_struct_vars->m_object_pointer_type = self_user_type;
                         return;
@@ -1420,14 +1392,11 @@ MaybePromoteToBlockPointerType
     return block_pointer_type.getAsOpaquePtr();
 }
 
-Value *
-ClangExpressionDeclMap::GetVariableValue
-(
-    VariableSP &var,
-    ASTContext *parser_ast_context,
-    TypeFromUser *user_type,
-    TypeFromParser *parser_type
-)
+bool
+ClangExpressionDeclMap::GetVariableValue (VariableSP &var,
+                                          lldb_private::Value &var_location,
+                                          TypeFromUser *user_type,
+                                          TypeFromParser *parser_type)
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
@@ -1437,34 +1406,31 @@ ClangExpressionDeclMap::GetVariableValue
     {
         if (log)
             log->PutCString("Skipped a definition because it has no type");
-        return NULL;
+        return false;
     }
     
-    clang_type_t var_opaque_type = var_type->GetClangFullType();
+    ClangASTType var_clang_type = var_type->GetClangFullType();
     
-    if (!var_opaque_type)
+    if (!var_clang_type)
     {
         if (log)
             log->PutCString("Skipped a definition because it has no Clang type");
-        return NULL;
+        return false;
     }
     
+    // commented out because of <rdar://problem/11024417>
     ASTContext *ast = var_type->GetClangASTContext().getASTContext();
-    
+
     if (!ast)
     {
         if (log)
             log->PutCString("There is no AST context for the current execution context");
-        return NULL;
+        return false;
     }
-
-    // commented out because of <rdar://problem/11024417>
-    //var_opaque_type = MaybePromoteToBlockPointerType (ast, var_opaque_type);
+    //var_clang_type = MaybePromoteToBlockPointerType (ast, var_clang_type);
     
     DWARFExpression &var_location_expr = var->LocationExpression();
     
-    std::unique_ptr<Value> var_location(new Value);
-    
     lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
     
     Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
@@ -1483,68 +1449,56 @@ ClangExpressionDeclMap::GetVariableValue
         
         if (var_location_expr.GetExpressionData(const_value_extractor))
         {
-            var_location->operator=(Value(const_value_extractor.GetDataStart(), const_value_extractor.GetByteSize()));
-            var_location->SetValueType(Value::eValueTypeHostAddress);
+            var_location = Value(const_value_extractor.GetDataStart(), const_value_extractor.GetByteSize());
+            var_location.SetValueType(Value::eValueTypeHostAddress);
         }
         else
         {
             if (log)
                 log->Printf("Error evaluating constant variable: %s", err.AsCString());
-            return NULL;
+            return false;
         }
     }
     
-    void *type_to_use = NULL;
+    ClangASTType type_to_use = GuardedCopyType(var_clang_type);
     
-    if (parser_ast_context)
+    if (!type_to_use)
     {
-        type_to_use = GuardedCopyType(parser_ast_context, ast, var_opaque_type);
-        
-        if (!type_to_use)
-        {
-            if (log)
-                log->Printf("Couldn't copy a variable's type into the parser's AST context");
-            
-            return NULL;
-        }
+        if (log)
+            log->Printf("Couldn't copy a variable's type into the parser's AST context");
         
-        if (parser_type)
-            *parser_type = TypeFromParser(type_to_use, parser_ast_context);
+        return false;
     }
-    else
-        type_to_use = var_opaque_type;
     
-    if (var_location.get()->GetContextType() == Value::eContextTypeInvalid)
-        var_location.get()->SetContext(Value::eContextTypeClangType, type_to_use);
+    if (parser_type)
+        *parser_type = TypeFromParser(type_to_use);
+    
+    if (var_location.GetContextType() == Value::eContextTypeInvalid)
+        var_location.SetClangType(type_to_use);
     
-    if (var_location.get()->GetValueType() == Value::eValueTypeFileAddress)
+    if (var_location.GetValueType() == Value::eValueTypeFileAddress)
     {
         SymbolContext var_sc;
         var->CalculateSymbolContext(&var_sc);
         
         if (!var_sc.module_sp)
             return NULL;
-        
-        ObjectFile *object_file = var_sc.module_sp->GetObjectFile();
-        
-        if (!object_file)
-            return NULL;
-        
-        Address so_addr(var_location->GetScalar().ULongLong(), object_file->GetSectionList());
+
+        Address so_addr(var_location.GetScalar().ULongLong(), var_sc.module_sp->GetSectionList());
         
         lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
         
         if (load_addr != LLDB_INVALID_ADDRESS)
         {
-            var_location->GetScalar() = load_addr;
-            var_location->SetValueType(Value::eValueTypeLoadAddress);
+            var_location.GetScalar() = load_addr;
+            var_location.SetValueType(Value::eValueTypeLoadAddress);
         }
     }
     
     if (user_type)
-        *user_type = TypeFromUser(var_opaque_type, ast);
+        *user_type = TypeFromUser(var_clang_type);
     
-    return var_location.release();
+    return true;
 }
 
 void
@@ -1556,11 +1510,10 @@ ClangExpressionDeclMap::AddOneVariable (
         
     TypeFromUser ut;
     TypeFromParser pt;
+    Value var_location;
     
-    Value *var_location = GetVariableValue (var, 
-                                            m_ast_context,
-                                            &ut,
-                                            &pt);
+    if (!GetVariableValue (var, var_location, &ut, &pt))
+        return;
     
     clang::QualType parser_opaque_type = QualType::getFromOpaquePtr(pt.GetOpaqueQualType());
     
@@ -1573,17 +1526,14 @@ ClangExpressionDeclMap::AddOneVariable (
             CompleteType(tag_type->getDecl());
     }
     
-    if (!var_location)
-        return;
-    
-    NamedDecl *var_decl;
     
-    bool is_reference = ClangASTContext::IsReferenceType(pt.GetOpaqueQualType());
+    bool is_reference = pt.IsReferenceType();
 
+    NamedDecl *var_decl = NULL;
     if (is_reference)
-        var_decl = context.AddVarDecl(pt.GetOpaqueQualType());
+        var_decl = context.AddVarDecl(pt);
     else
-        var_decl = context.AddVarDecl(ClangASTContext::CreateLValueReferenceType(pt.GetASTContext(), pt.GetOpaqueQualType()));
+        var_decl = context.AddVarDecl(pt.GetLValueReferenceType());
         
     std::string decl_name(context.m_decl_name.getAsString());
     ConstString entity_name(decl_name.c_str());
@@ -1618,10 +1568,7 @@ ClangExpressionDeclMap::AddOneVariable(N
     
     TypeFromUser user_type (pvar_sp->GetTypeFromUser());
     
-    TypeFromParser parser_type (GuardedCopyType(m_ast_context, 
-                                                user_type.GetASTContext(), 
-                                                user_type.GetOpaqueQualType()),
-                                m_ast_context);
+    TypeFromParser parser_type (GuardedCopyType(user_type));
     
     if (!parser_type.GetOpaqueQualType())
     {
@@ -1630,14 +1577,14 @@ ClangExpressionDeclMap::AddOneVariable(N
         return;
     }
     
-    NamedDecl *var_decl = context.AddVarDecl(ClangASTContext::CreateLValueReferenceType(parser_type.GetASTContext(), parser_type.GetOpaqueQualType()));
+    NamedDecl *var_decl = context.AddVarDecl(parser_type.GetLValueReferenceType());
     
     pvar_sp->EnableParserVars(GetParserID());
     ClangExpressionVariable::ParserVars *parser_vars = pvar_sp->GetParserVars(GetParserID());
     parser_vars->m_parser_type = parser_type;
-    parser_vars->m_named_decl  = var_decl;
-    parser_vars->m_llvm_value  = NULL;
-    parser_vars->m_lldb_value  = NULL;
+    parser_vars->m_named_decl = var_decl;
+    parser_vars->m_llvm_value = NULL;
+    parser_vars->m_lldb_value.Clear();
     
     if (log)
     {
@@ -1662,13 +1609,9 @@ ClangExpressionDeclMap::AddOneGenericVar
 
     ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext();
     
-    TypeFromUser user_type (ClangASTContext::CreateLValueReferenceType(scratch_ast_context, ClangASTContext::GetVoidPtrType(scratch_ast_context, false)),
-                            scratch_ast_context);
-    
-    TypeFromParser parser_type (ClangASTContext::CreateLValueReferenceType(m_ast_context, ClangASTContext::GetVoidPtrType(m_ast_context, false)),
-                                m_ast_context);
-    
-    NamedDecl *var_decl = context.AddVarDecl(parser_type.GetOpaqueQualType());
+    TypeFromUser user_type (ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
+    TypeFromParser parser_type (ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
+    NamedDecl *var_decl = context.AddVarDecl(parser_type);
     
     std::string decl_name(context.m_decl_name.getAsString());
     ConstString entity_name(decl_name.c_str());
@@ -1679,21 +1622,20 @@ ClangExpressionDeclMap::AddOneGenericVar
                                                                       m_parser_vars->m_target_info.address_byte_size));
     assert (entity.get());
     
-    std::unique_ptr<Value> symbol_location(new Value);
-    
+    entity->EnableParserVars(GetParserID());
+    ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID());
+
     const Address &symbol_address = symbol.GetAddress();
     lldb::addr_t symbol_load_addr = symbol_address.GetLoadAddress(target);
     
-    symbol_location->SetContext(Value::eContextTypeClangType, user_type.GetOpaqueQualType());
-    symbol_location->GetScalar() = symbol_load_addr;
-    symbol_location->SetValueType(Value::eValueTypeLoadAddress);
+    //parser_vars->m_lldb_value.SetContext(Value::eContextTypeClangType, user_type.GetOpaqueQualType());
+    parser_vars->m_lldb_value.SetClangType(user_type);
+    parser_vars->m_lldb_value.GetScalar() = symbol_load_addr;
+    parser_vars->m_lldb_value.SetValueType(Value::eValueTypeLoadAddress);
     
-    entity->EnableParserVars(GetParserID());
-    ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID());
     parser_vars->m_parser_type = parser_type;
     parser_vars->m_named_decl  = var_decl;
     parser_vars->m_llvm_value  = NULL;
-    parser_vars->m_lldb_value  = symbol_location.release();
     parser_vars->m_lldb_sym    = &symbol;
     
     if (log)
@@ -1753,11 +1695,11 @@ ClangExpressionDeclMap::ResolveUnknownTy
             
             TypeFromUser user_type(copied_type, scratch_ast_context);
                         
-            parser_vars->m_lldb_value->SetContext(Value::eContextTypeClangType, user_type.GetOpaqueQualType());
+//            parser_vars->m_lldb_value.SetContext(Value::eContextTypeClangType, user_type.GetOpaqueQualType());
+            parser_vars->m_lldb_value.SetClangType(user_type);
             parser_vars->m_parser_type = parser_type;
             
-            entity->SetClangAST(user_type.GetASTContext());
-            entity->SetClangType(user_type.GetOpaqueQualType());
+            entity->SetClangType(user_type);
             
             entity->m_flags &= ~(ClangExpressionVariable::EVUnknownType);
         }
@@ -1773,21 +1715,20 @@ ClangExpressionDeclMap::AddOneRegister (
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
-    void *ast_type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(m_ast_context,
-                                                                          reg_info->encoding,
-                                                                          reg_info->byte_size * 8);
+    ClangASTType clang_type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize (m_ast_context,
+                                                                                    reg_info->encoding,
+                                                                                    reg_info->byte_size * 8);
     
-    if (!ast_type)
+    if (!clang_type)
     {
         if (log)
             log->Printf("  Tried to add a type for %s, but couldn't get one", context.m_decl_name.getAsString().c_str());
         return;
     }
     
-    TypeFromParser parser_type (ast_type,
-                                m_ast_context);
+    TypeFromParser parser_clang_type (clang_type);
     
-    NamedDecl *var_decl = context.AddVarDecl(parser_type.GetOpaqueQualType());
+    NamedDecl *var_decl = context.AddVarDecl(parser_clang_type);
     
     ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(),
                                                                       m_parser_vars->m_target_info.byte_order,
@@ -1799,10 +1740,10 @@ ClangExpressionDeclMap::AddOneRegister (
     entity->SetRegisterInfo (reg_info);
     entity->EnableParserVars(GetParserID());
     ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID());
-    parser_vars->m_parser_type = parser_type;
-    parser_vars->m_named_decl  = var_decl;
-    parser_vars->m_llvm_value  = NULL;
-    parser_vars->m_lldb_value  = NULL;
+    parser_vars->m_parser_type = parser_clang_type;
+    parser_vars->m_named_decl = var_decl;
+    parser_vars->m_llvm_value = NULL;
+    parser_vars->m_lldb_value.Clear();
     entity->m_flags |= ClangExpressionVariable::EVBareRegister;
     
     if (log)
@@ -1814,7 +1755,7 @@ ClangExpressionDeclMap::AddOneRegister (
 
 void
 ClangExpressionDeclMap::AddOneFunction (NameSearchContext &context,
-                                        Function* fun,
+                                        Function* function,
                                         Symbol* symbol,
                                         unsigned int current_id)
 {
@@ -1822,51 +1763,46 @@ ClangExpressionDeclMap::AddOneFunction (
     
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
-    NamedDecl *fun_decl = NULL;
-    std::unique_ptr<Value> fun_location(new Value);
+    NamedDecl *function_decl = NULL;
     const Address *fun_address = NULL;
-    
-    // only valid for Functions, not for Symbols
-    void *fun_opaque_type = NULL;
-    ASTContext *fun_ast_context = NULL;
+    ClangASTType function_clang_type;
 
     bool is_indirect_function = false;
 
-    if (fun)
+    if (function)
     {
-        Type *fun_type = fun->GetType();
+        Type *function_type = function->GetType();
         
-        if (!fun_type) 
+        if (!function_type)
         {
             if (log)
                 log->PutCString("  Skipped a function because it has no type");
             return;
         }
         
-        fun_opaque_type = fun_type->GetClangFullType();
+        function_clang_type = function_type->GetClangFullType();
         
-        if (!fun_opaque_type)
+        if (!function_clang_type)
         {
             if (log)
                 log->PutCString("  Skipped a function because it has no Clang type");
             return;
         }
         
-        fun_address = &fun->GetAddressRange().GetBaseAddress();
+        fun_address = &function->GetAddressRange().GetBaseAddress();
         
-        fun_ast_context = fun_type->GetClangASTContext().getASTContext();
-        void *copied_type = GuardedCopyType(m_ast_context, fun_ast_context, fun_opaque_type);
-        if (copied_type)
+        ClangASTType copied_function_type = GuardedCopyType(function_clang_type);
+        if (copied_function_type)
         {
-            fun_decl = context.AddFunDecl(copied_type);
+            function_decl = context.AddFunDecl(copied_function_type);
             
-            if (!fun_decl)
+            if (!function_decl)
             {
                 if (log)
                 {
                     log->Printf ("  Failed to create a function decl for '%s' {0x%8.8" PRIx64 "}",
-                                 fun_type->GetName().GetCString(),
-                                 fun_type->GetID());
+                                 function_type->GetName().GetCString(),
+                                 function_type->GetID());
                 }
                 
                 return;
@@ -1878,8 +1814,8 @@ ClangExpressionDeclMap::AddOneFunction (
             if (log)
             {
                 log->Printf ("  Failed to import the function type '%s' {0x%8.8" PRIx64 "} into the expression parser AST contenxt",
-                             fun_type->GetName().GetCString(), 
-                             fun_type->GetID());
+                             function_type->GetName().GetCString(),
+                             function_type->GetID());
             }
             
             return;
@@ -1888,7 +1824,7 @@ ClangExpressionDeclMap::AddOneFunction (
     else if (symbol)
     {
         fun_address = &symbol->GetAddress();
-        fun_decl = context.AddGenericFunDecl();
+        function_decl = context.AddGenericFunDecl();
         is_indirect_function = symbol->IsIndirect();
     }
     else
@@ -1902,10 +1838,22 @@ ClangExpressionDeclMap::AddOneFunction (
 
     lldb::addr_t load_addr = fun_address->GetCallableLoadAddress(target, is_indirect_function);
     
+    ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope (),
+                                                                      m_parser_vars->m_target_info.byte_order,
+                                                                      m_parser_vars->m_target_info.address_byte_size));
+    assert (entity.get());
+
+    std::string decl_name(context.m_decl_name.getAsString());
+    entity->SetName(ConstString(decl_name.c_str()));
+    entity->SetClangType (function_clang_type);
+    entity->EnableParserVars(GetParserID());
+
+    ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID());
+    
     if (load_addr != LLDB_INVALID_ADDRESS)
     {
-        fun_location->SetValueType(Value::eValueTypeLoadAddress);
-        fun_location->GetScalar() = load_addr;
+        parser_vars->m_lldb_value.SetValueType(Value::eValueTypeLoadAddress);
+        parser_vars->m_lldb_value.GetScalar() = load_addr;
     }
     else
     {
@@ -1913,28 +1861,17 @@ ClangExpressionDeclMap::AddOneFunction (
         
         lldb::addr_t file_addr = fun_address->GetFileAddress();
         
-        fun_location->SetValueType(Value::eValueTypeFileAddress);
-        fun_location->GetScalar() = file_addr;
+        parser_vars->m_lldb_value.SetValueType(Value::eValueTypeFileAddress);
+        parser_vars->m_lldb_value.GetScalar() = file_addr;
     }
     
-    ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope (),
-                                                                      m_parser_vars->m_target_info.byte_order,
-                                                                      m_parser_vars->m_target_info.address_byte_size));
-    assert (entity.get());
-    std::string decl_name(context.m_decl_name.getAsString());
-    entity->SetName(ConstString(decl_name.c_str()));
-    entity->SetClangType (fun_opaque_type);
-    entity->SetClangAST (fun_ast_context);
-    
-    entity->EnableParserVars(GetParserID());
-    ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID());
-    parser_vars->m_named_decl  = fun_decl;
+
+    parser_vars->m_named_decl  = function_decl;
     parser_vars->m_llvm_value  = NULL;
-    parser_vars->m_lldb_value  = fun_location.release();
-        
+    
     if (log)
     {
-        ASTDumper ast_dumper(fun_decl);
+        ASTDumper ast_dumper(function_decl);
         
         StreamString ss;
         
@@ -1942,7 +1879,7 @@ ClangExpressionDeclMap::AddOneFunction (
         
         log->Printf("  CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
                     current_id,
-                    (fun ? "specific" : "generic"), 
+                    (function ? "specific" : "generic"),
                     decl_name.c_str(),
                     ss.GetData(),
                     ast_dumper.GetCString());
@@ -1953,12 +1890,9 @@ TypeFromParser
 ClangExpressionDeclMap::CopyClassType(TypeFromUser &ut,
                                       unsigned int current_id)
 {
-    ASTContext *parser_ast_context = m_ast_context;
-    ASTContext *user_ast_context = ut.GetASTContext();
-
-    void *copied_type = GuardedCopyType(parser_ast_context, user_ast_context, ut.GetOpaqueQualType());
+    ClangASTType copied_clang_type = GuardedCopyType(ut);
     
-    if (!copied_type)
+    if (!copied_clang_type)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
@@ -1968,18 +1902,17 @@ ClangExpressionDeclMap::CopyClassType(Ty
         return TypeFromParser();
     }
 
-    if (ClangASTContext::IsAggregateType(copied_type) && ClangASTContext::GetCompleteType (parser_ast_context, copied_type))
+    if (copied_clang_type.IsAggregateType() && copied_clang_type.GetCompleteType ())
     {
-        void *args[1];
+        ClangASTType void_clang_type = ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid);
+        ClangASTType void_ptr_clang_type = void_clang_type.GetPointerType();
         
-        args[0] = ClangASTContext::GetVoidPtrType(parser_ast_context, false);
-        
-        clang_type_t method_type = ClangASTContext::CreateFunctionType (parser_ast_context,
-                                                                        ClangASTContext::GetBuiltInType_void(parser_ast_context),
-                                                                        args,
+        ClangASTType method_type = ClangASTContext::CreateFunctionType (m_ast_context,
+                                                                        void_clang_type,
+                                                                        &void_ptr_clang_type,
                                                                         1,
                                                                         false,
-                                                                        ClangASTContext::GetTypeQualifiers(copied_type));
+                                                                        copied_clang_type.GetTypeQualifiers());
         
         const bool is_virtual = false;
         const bool is_static = false;
@@ -1988,20 +1921,18 @@ ClangExpressionDeclMap::CopyClassType(Ty
         const bool is_attr_used = true;
         const bool is_artificial = false;
         
-        ClangASTContext::AddMethodToCXXRecordType (parser_ast_context,
-                                                   copied_type,
-                                                   "$__lldb_expr",
-                                                   method_type,
-                                                   lldb::eAccessPublic,
-                                                   is_virtual,
-                                                   is_static,
-                                                   is_inline,
-                                                   is_explicit,
-                                                   is_attr_used,
-                                                   is_artificial);
+        copied_clang_type.AddMethodToCXXRecordType ("$__lldb_expr",
+                                                    method_type,
+                                                    lldb::eAccessPublic,
+                                                    is_virtual,
+                                                    is_static,
+                                                    is_inline,
+                                                    is_explicit,
+                                                    is_attr_used,
+                                                    is_artificial);
     }
     
-    return TypeFromParser(copied_type, parser_ast_context);
+    return TypeFromParser(copied_clang_type);
 }
 
 void 
@@ -2009,12 +1940,9 @@ ClangExpressionDeclMap::AddOneType(NameS
                                    TypeFromUser &ut,
                                    unsigned int current_id)
 {
-    ASTContext *parser_ast_context = m_ast_context;
-    ASTContext *user_ast_context = ut.GetASTContext();
-    
-    void *copied_type = GuardedCopyType(parser_ast_context, user_ast_context, ut.GetOpaqueQualType());
+    ClangASTType copied_clang_type = GuardedCopyType(ut);
     
-    if (!copied_type)
+    if (!copied_clang_type)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
@@ -2024,5 +1952,5 @@ ClangExpressionDeclMap::AddOneType(NameS
         return;
     }
     
-    context.AddTypeDecl(copied_type);
+    context.AddTypeDecl(copied_clang_type);
 }

Modified: lldb/branches/lldb-platform-work/source/Expression/ClangExpressionVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangExpressionVariable.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangExpressionVariable.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangExpressionVariable.cpp Wed Jul 17 17:17:41 2013
@@ -74,34 +74,23 @@ ClangExpressionVariable::SetRegisterInfo
     return m_frozen_sp->GetValue().SetContext (Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_info));
 }
 
-lldb::clang_type_t
+ClangASTType
 ClangExpressionVariable::GetClangType()
 {
     return m_frozen_sp->GetClangType();
 }    
 
 void
-ClangExpressionVariable::SetClangType(lldb::clang_type_t clang_type)
+ClangExpressionVariable::SetClangType(const ClangASTType &clang_type)
 {
-    m_frozen_sp->GetValue().SetContext(Value::eContextTypeClangType, clang_type);
+    m_frozen_sp->GetValue().SetClangType(clang_type);
 }    
 
-clang::ASTContext *
-ClangExpressionVariable::GetClangAST()
-{
-    return m_frozen_sp->GetClangAST();
-}    
-
-void
-ClangExpressionVariable::SetClangAST (clang::ASTContext *ast)
-{
-    m_frozen_sp->SetClangAST (ast);
-}
 
 TypeFromUser
 ClangExpressionVariable::GetTypeFromUser()
 {
-    TypeFromUser tfu (m_frozen_sp->GetClangType(), m_frozen_sp->GetClangAST());
+    TypeFromUser tfu (m_frozen_sp->GetClangType());
     return tfu;
 }    
 

Modified: lldb/branches/lldb-platform-work/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangFunction.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangFunction.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangFunction.cpp Wed Jul 17 17:17:41 2013
@@ -51,15 +51,13 @@ using namespace lldb_private;
 ClangFunction::ClangFunction 
 (
     ExecutionContextScope &exe_scope,
-    ClangASTContext *ast_context, 
-    void *return_qualtype, 
+    const ClangASTType &return_type, 
     const Address& functionAddress, 
     const ValueList &arg_value_list
 ) :
     m_function_ptr (NULL),
     m_function_addr (functionAddress),
-    m_function_return_qual_type(return_qualtype),
-    m_clang_ast_context (ast_context),
+    m_function_return_type(return_type),
     m_wrapper_function_name ("__lldb_caller_function"),
     m_wrapper_struct_name ("__lldb_caller_struct"),
     m_wrapper_args_addrs (),
@@ -81,7 +79,7 @@ ClangFunction::ClangFunction
 ) :
     m_function_ptr (&function),
     m_function_addr (),
-    m_function_return_qual_type (),
+    m_function_return_type (),
     m_clang_ast_context (ast_context),
     m_wrapper_function_name ("__lldb_function_caller"),
     m_wrapper_struct_name ("__lldb_caller_struct"),
@@ -95,7 +93,7 @@ ClangFunction::ClangFunction
     assert (m_jit_process_wp.lock());
 
     m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
-    m_function_return_qual_type = m_function_ptr->GetReturnClangType();
+    m_function_return_type = m_function_ptr->GetClangType().GetFunctionReturnType();
 }
 
 //----------------------------------------------------------------------
@@ -114,8 +112,7 @@ ClangFunction::CompileFunction (Stream &
     // FIXME: How does clang tell us there's no return value?  We need to handle that case.
     unsigned num_errors = 0;
     
-    std::string return_type_str (ClangASTType::GetTypeNameForOpaqueQualType (m_clang_ast_context->getASTContext(),
-                                                                             m_function_return_qual_type));
+    std::string return_type_str (m_function_return_type.GetTypeName());
     
     // Cons up the function we're going to wrap our call in, then compile it...
     // We declare the function "extern "C"" because the compiler might be in C++
@@ -137,16 +134,22 @@ ClangFunction::CompileFunction (Stream &
     // to pull the defined arguments out of the function, then add the types from the
     // arguments list for the variable arguments.
 
-    size_t num_args = UINT32_MAX;
+    uint32_t num_args = UINT32_MAX;
     bool trust_function = false;
     // GetArgumentCount returns -1 for an unprototyped function.
+    ClangASTType function_clang_type;
     if (m_function_ptr)
     {
-        int num_func_args = m_function_ptr->GetArgumentCount();
-        if (num_func_args >= 0)
-            trust_function = true;
-        else
-            num_args = num_func_args;
+        function_clang_type = m_function_ptr->GetClangType();
+        if (function_clang_type)
+        {
+            int num_func_args = function_clang_type.GetFunctionArgumentCount();
+            if (num_func_args >= 0)
+            {
+                trust_function = true;
+                num_args = num_func_args;
+            }
+        }
     }
 
     if (num_args == UINT32_MAX)
@@ -160,18 +163,14 @@ ClangFunction::CompileFunction (Stream &
 
         if (trust_function)
         {
-            lldb::clang_type_t arg_clang_type = m_function_ptr->GetArgumentTypeAtIndex(i);
-            type_name = ClangASTType::GetTypeNameForOpaqueQualType (m_clang_ast_context->getASTContext(),
-                                                                    arg_clang_type);
+            type_name = function_clang_type.GetFunctionArgumentTypeAtIndex(i).GetTypeName();
         }
         else
         {
-            Value *arg_value = m_arg_values.GetValueAtIndex(i);
-            lldb::clang_type_t clang_qual_type = arg_value->GetClangType ();
-            if (clang_qual_type != NULL)
+            ClangASTType clang_qual_type = m_arg_values.GetValueAtIndex(i)->GetClangType ();
+            if (clang_qual_type)
             {
-                type_name = ClangASTType::GetTypeNameForOpaqueQualType (m_clang_ast_context->getASTContext(),
-                                                                        clang_qual_type);
+                type_name = clang_qual_type.GetTypeName();
             }
             else
             {   
@@ -362,11 +361,11 @@ ClangFunction::WriteFunctionArguments (E
         // Special case: if it's a pointer, don't do anything (the ABI supports passing cstrings)
         
         if (arg_value->GetValueType() == Value::eValueTypeHostAddress &&
-            arg_value->GetContextType() == Value::eContextTypeClangType &&
-            ClangASTContext::IsPointerType(arg_value->GetClangType()))
+            arg_value->GetContextType() == Value::eContextTypeInvalid &&
+            arg_value->GetClangType().IsPointerType())
             continue;
         
-        const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx, m_clang_ast_context->getASTContext());
+        const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx);
 
         if (!process->WriteScalarToMemory(args_addr_ref + offset, arg_scalar, arg_scalar.GetByteSize(), error))
             return false;
@@ -464,7 +463,7 @@ ClangFunction::FetchFunctionResults (Exe
     if (error.Fail())
         return false;
 
-    ret_value.SetContext (Value::eContextTypeClangType, m_function_return_qual_type);
+    ret_value.SetClangType(m_function_return_type);
     ret_value.SetValueType(Value::eValueTypeScalar);
     return true;
 }

Modified: lldb/branches/lldb-platform-work/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangUserExpression.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangUserExpression.cpp Wed Jul 17 17:17:41 2013
@@ -297,21 +297,19 @@ ClangUserExpression::ScanContext(Executi
                         return;
                     }
                     
-                    lldb::clang_type_t self_opaque_type = self_type->GetClangForwardType();
+                    ClangASTType self_clang_type = self_type->GetClangForwardType();
                     
-                    if (!self_opaque_type)
+                    if (!self_clang_type)
                     {
                         err.SetErrorString(selfErrorString);
                         return;
                     }
-                    
-                    clang::QualType self_qual_type = clang::QualType::getFromOpaquePtr(self_opaque_type);
-                    
-                    if (self_qual_type->isObjCClassType())
+                                        
+                    if (self_clang_type.IsObjCClassType())
                     {
                         return;
                     }
-                    else if (self_qual_type->isObjCObjectPointerType())
+                    else if (self_clang_type.IsObjCObjectPointerType())
                     {
                         m_objectivec = true;
                         m_needs_object_ptr = true;
@@ -487,6 +485,26 @@ ClangUserExpression::Parse (Stream &erro
         
     m_expr_decl_map.reset(new ClangExpressionDeclMap(keep_result_in_memory, exe_ctx));
     
+    class OnExit
+    {
+    public:
+        typedef std::function <void (void)> Callback;
+        
+        OnExit (Callback const &callback) :
+            m_callback(callback)
+        {
+        }
+        
+        ~OnExit ()
+        {
+            m_callback();
+        }
+    private:
+        Callback m_callback;
+    };
+    
+    OnExit on_exit([this]() { m_expr_decl_map.reset(); });
+    
     if (!m_expr_decl_map->WillParse(exe_ctx, m_materializer_ap.get()))
     {
         error_stream.PutCString ("error: current process state is unsuitable for expression parsing\n");
@@ -735,8 +753,6 @@ ClangUserExpression::FinalizeJITExecutio
                                            lldb::addr_t function_stack_bottom,
                                            lldb::addr_t function_stack_top)
 {
-    Error expr_error;
-    
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (log)
@@ -744,7 +760,7 @@ ClangUserExpression::FinalizeJITExecutio
         
     if (!m_dematerializer_sp)
     {
-        error_stream.Printf ("Couldn't dematerialize struct : no dematerializer is present");
+        error_stream.Printf ("Couldn't apply expression side effects : no dematerializer is present");
         return false;
     }
     
@@ -754,7 +770,7 @@ ClangUserExpression::FinalizeJITExecutio
 
     if (!dematerialize_error.Success())
     {
-        error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
+        error_stream.Printf ("Couldn't apply expression side effects : %s\n", dematerialize_error.AsCString("unknown error"));
         return false;
     }
         
@@ -919,7 +935,6 @@ ClangUserExpression::Execute (Stream &er
         }
         else
         {
-            error_stream.Printf("Errored out in %s: Couldn't FinalizeJITExpression", __FUNCTION__);
             return eExecutionSetupError;
         }
     }

Modified: lldb/branches/lldb-platform-work/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/DWARFExpression.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/DWARFExpression.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/DWARFExpression.cpp Wed Jul 17 17:17:41 2013
@@ -1195,7 +1195,6 @@ bool
 DWARFExpression::Evaluate
 (
     ExecutionContextScope *exe_scope,
-    clang::ASTContext *ast_context,
     ClangExpressionVariableList *expr_locals,
     ClangExpressionDeclMap *decl_map,
     lldb::addr_t loclist_base_load_addr,
@@ -1205,14 +1204,13 @@ DWARFExpression::Evaluate
 ) const
 {
     ExecutionContext exe_ctx (exe_scope);
-    return Evaluate(&exe_ctx, ast_context, expr_locals, decl_map, NULL, loclist_base_load_addr, initial_value_ptr, result, error_ptr);
+    return Evaluate(&exe_ctx, expr_locals, decl_map, NULL, loclist_base_load_addr, initial_value_ptr, result, error_ptr);
 }
 
 bool
 DWARFExpression::Evaluate
 (
     ExecutionContext *exe_ctx,
-    clang::ASTContext *ast_context,
     ClangExpressionVariableList *expr_locals,
     ClangExpressionDeclMap *decl_map,
     RegisterContext *reg_ctx,
@@ -1269,7 +1267,7 @@ DWARFExpression::Evaluate
 
                     if (length > 0 && lo_pc <= pc && pc < hi_pc)
                     {
-                        return DWARFExpression::Evaluate (exe_ctx, ast_context, expr_locals, decl_map, reg_ctx, m_data, offset, length, m_reg_kind, initial_value_ptr, result, error_ptr);
+                        return DWARFExpression::Evaluate (exe_ctx, expr_locals, decl_map, reg_ctx, m_data, offset, length, m_reg_kind, initial_value_ptr, result, error_ptr);
                     }
                     offset += length;
                 }
@@ -1281,7 +1279,7 @@ DWARFExpression::Evaluate
     }
 
     // Not a location list, just a single expression.
-    return DWARFExpression::Evaluate (exe_ctx, ast_context, expr_locals, decl_map, reg_ctx, m_data, 0, m_data.GetByteSize(), m_reg_kind, initial_value_ptr, result, error_ptr);
+    return DWARFExpression::Evaluate (exe_ctx, expr_locals, decl_map, reg_ctx, m_data, 0, m_data.GetByteSize(), m_reg_kind, initial_value_ptr, result, error_ptr);
 }
 
 
@@ -1290,7 +1288,6 @@ bool
 DWARFExpression::Evaluate
 (
     ExecutionContext *exe_ctx,
-    clang::ASTContext *ast_context,
     ClangExpressionVariableList *expr_locals,
     ClangExpressionDeclMap *decl_map,
     RegisterContext *reg_ctx,
@@ -1769,7 +1766,7 @@ DWARFExpression::Evaluate
                     error_ptr->SetErrorString("Expression stack needs at least 1 item for DW_OP_abs.");
                 return false;
             }
-            else if (stack.back().ResolveValue(exe_ctx, ast_context).AbsoluteValue() == false)
+            else if (stack.back().ResolveValue(exe_ctx).AbsoluteValue() == false)
             {
                 if (error_ptr)
                     error_ptr->SetErrorString("Failed to take the absolute value of the first stack item.");
@@ -1794,7 +1791,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) & tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) & tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -1815,7 +1812,7 @@ DWARFExpression::Evaluate
             else
             {
                 tmp = stack.back();
-                if (tmp.ResolveValue(exe_ctx, ast_context).IsZero())
+                if (tmp.ResolveValue(exe_ctx).IsZero())
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("Divide by zero.");
@@ -1824,8 +1821,8 @@ DWARFExpression::Evaluate
                 else
                 {
                     stack.pop_back();
-                    stack.back() = stack.back().ResolveValue(exe_ctx, ast_context) / tmp.ResolveValue(exe_ctx, ast_context);
-                    if (!stack.back().ResolveValue(exe_ctx, ast_context).IsValid())
+                    stack.back() = stack.back().ResolveValue(exe_ctx) / tmp.ResolveValue(exe_ctx);
+                    if (!stack.back().ResolveValue(exe_ctx).IsValid())
                     {
                         if (error_ptr)
                             error_ptr->SetErrorString("Divide failed.");
@@ -1852,7 +1849,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) - tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) - tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -1874,7 +1871,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) % tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) % tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -1896,7 +1893,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) * tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) * tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -1914,7 +1911,7 @@ DWARFExpression::Evaluate
             }
             else
             {
-                if (stack.back().ResolveValue(exe_ctx, ast_context).UnaryNegate() == false)
+                if (stack.back().ResolveValue(exe_ctx).UnaryNegate() == false)
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("Unary negate failed.");
@@ -1938,7 +1935,7 @@ DWARFExpression::Evaluate
             }
             else
             {
-                if (stack.back().ResolveValue(exe_ctx, ast_context).OnesComplement() == false)
+                if (stack.back().ResolveValue(exe_ctx).OnesComplement() == false)
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("Logical NOT failed.");
@@ -1964,7 +1961,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) | tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) | tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -1985,7 +1982,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) + tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) + tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2006,8 +2003,8 @@ DWARFExpression::Evaluate
             {
                 const uint64_t uconst_value = opcodes.GetULEB128(&offset);
                 // Implicit conversion from a UINT to a Scalar...
-                stack.back().ResolveValue(exe_ctx, ast_context) += uconst_value;
-                if (!stack.back().ResolveValue(exe_ctx, ast_context).IsValid())
+                stack.back().ResolveValue(exe_ctx) += uconst_value;
+                if (!stack.back().ResolveValue(exe_ctx).IsValid())
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("DW_OP_plus_uconst failed.");
@@ -2034,7 +2031,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) <<= tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) <<= tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2056,7 +2053,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                if (stack.back().ResolveValue(exe_ctx, ast_context).ShiftRightLogical(tmp.ResolveValue(exe_ctx, ast_context)) == false)
+                if (stack.back().ResolveValue(exe_ctx).ShiftRightLogical(tmp.ResolveValue(exe_ctx)) == false)
                 {
                     if (error_ptr)
                         error_ptr->SetErrorString("DW_OP_shr failed.");
@@ -2084,7 +2081,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) >>= tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) >>= tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2105,7 +2102,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) ^ tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) ^ tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2149,7 +2146,7 @@ DWARFExpression::Evaluate
                 stack.pop_back();
                 int16_t bra_offset = (int16_t)opcodes.GetU16(&offset);
                 Scalar zero(0);
-                if (tmp.ResolveValue(exe_ctx, ast_context) != zero)
+                if (tmp.ResolveValue(exe_ctx) != zero)
                 {
                     lldb::offset_t new_offset = offset + bra_offset;
                     if (new_offset >= opcodes_offset && new_offset < end_offset)
@@ -2184,7 +2181,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) == tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) == tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2208,7 +2205,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) >= tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) >= tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2232,7 +2229,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) > tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) > tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2256,7 +2253,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) <= tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) <= tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2280,7 +2277,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) < tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) < tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2304,7 +2301,7 @@ DWARFExpression::Evaluate
             {
                 tmp = stack.back();
                 stack.pop_back();
-                stack.back().ResolveValue(exe_ctx, ast_context) = stack.back().ResolveValue(exe_ctx, ast_context) != tmp.ResolveValue(exe_ctx, ast_context);
+                stack.back().ResolveValue(exe_ctx) = stack.back().ResolveValue(exe_ctx) != tmp.ResolveValue(exe_ctx);
             }
             break;
 
@@ -2457,7 +2454,7 @@ DWARFExpression::Evaluate
                 if (ReadRegisterValueAsScalar (reg_ctx, reg_kind, reg_num, error_ptr, tmp))
                 {
                     int64_t breg_offset = opcodes.GetSLEB128(&offset);
-                    tmp.ResolveValue(exe_ctx, ast_context) += (uint64_t)breg_offset;
+                    tmp.ResolveValue(exe_ctx) += (uint64_t)breg_offset;
                     tmp.ClearContext();
                     stack.push_back(tmp);
                     stack.back().SetValueType (Value::eValueTypeLoadAddress);
@@ -2481,7 +2478,7 @@ DWARFExpression::Evaluate
                 if (ReadRegisterValueAsScalar (reg_ctx, reg_kind, reg_num, error_ptr, tmp))
                 {
                     int64_t breg_offset = opcodes.GetSLEB128(&offset);
-                    tmp.ResolveValue(exe_ctx, ast_context) += (uint64_t)breg_offset;
+                    tmp.ResolveValue(exe_ctx) += (uint64_t)breg_offset;
                     tmp.ClearContext();
                     stack.push_back(tmp);
                     stack.back().SetValueType (Value::eValueTypeLoadAddress);
@@ -2630,566 +2627,6 @@ DWARFExpression::Evaluate
         case DW_OP_stack_value:
             stack.back().SetValueType(Value::eValueTypeScalar);
             break;
-
-#if 0
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_call_ref
-        // OPERANDS:
-        //      uint32_t absolute DIE offset for 32-bit DWARF or a uint64_t
-        //               absolute DIE offset for 64 bit DWARF.
-        // DESCRIPTION: Performs a subroutine call during evaluation of a DWARF
-        // expression. Takes a single operand. In the 32-bit DWARF format, the
-        // operand is a 4-byte unsigned value; in the 64-bit DWARF format, it
-        // is an 8-byte unsigned value. The operand is used as the offset of a
-        // debugging information entry in a .debug_info section which may be
-        // contained in a shared object for executable other than that
-        // containing the operator. For references from one shared object or
-        // executable to another, the relocation must be performed by the
-        // consumer.
-        //
-        // Operand interpretation of DW_OP_call_ref is exactly like that for
-        // DW_FORM_ref_addr.
-        //
-        // This operation transfers control of DWARF expression evaluation
-        // to the DW_AT_location attribute of the referenced DIE. If there is
-        // no such attribute, then there is no effect. Execution of the DWARF
-        // expression of a DW_AT_location attribute may add to and/or remove from
-        // values on the stack. Execution returns to the point following the call
-        // when the end of the attribute is reached. Values on the stack at the
-        // time of the call may be used as parameters by the called expression
-        // and values left on the stack by the called expression may be used as
-        // return values by prior agreement between the calling and called
-        // expressions.
-        //----------------------------------------------------------------------
-        case DW_OP_call_ref:
-            if (error_ptr)
-                error_ptr->SetErrorString ("Unimplemented opcode DW_OP_call_ref.");
-            return false;
-
-                //----------------------------------------------------------------------
-                // OPCODE: DW_OP_APPLE_array_ref
-                // OPERANDS: none
-                // DESCRIPTION: Pops a value off the stack and uses it as the array 
-                // index.  Pops a second value off the stack and uses it as the array
-                // itself.  Pushes a value onto the stack representing the element of
-                // the array specified by the index.
-                //----------------------------------------------------------------------
-            case DW_OP_APPLE_array_ref:
-            {
-                if (stack.size() < 2)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Expression stack needs at least 2 items for DW_OP_APPLE_array_ref.");
-                    return false;
-                }
-                
-                Value index_val = stack.back();
-                stack.pop_back();
-                Value array_val = stack.back();
-                stack.pop_back();
-                
-                Scalar &index_scalar = index_val.ResolveValue(exe_ctx, ast_context);
-                int64_t index = index_scalar.SLongLong(LLONG_MAX);
-                
-                if (index == LLONG_MAX)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Invalid array index.");
-                    return false;
-                }
-                
-                if (array_val.GetContextType() != Value::eContextTypeClangType)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Arrays without Clang types are unhandled at this time.");
-                    return false;
-                }
-                
-                if (array_val.GetValueType() != Value::eValueTypeLoadAddress &&
-                    array_val.GetValueType() != Value::eValueTypeHostAddress)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Array must be stored in memory.");
-                    return false;
-                }
-                
-                void *array_type = array_val.GetClangType();
-                
-                void *member_type;
-                uint64_t size = 0;
-                
-                if ((!ClangASTContext::IsPointerType(array_type, &member_type)) &&
-                    (!ClangASTContext::IsArrayType(array_type, &member_type, &size)))
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Array reference from something that is neither a pointer nor an array.");
-                    return false;
-                }
-                
-                if (size && (index >= size || index < 0))
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat("Out of bounds array access.  %" PRId64 " is not in [0, %" PRIu64 "]", index, size);
-                    return false;
-                }
-                
-                uint64_t member_bit_size = ClangASTType::GetClangTypeBitWidth(ast_context, member_type);
-                uint64_t member_bit_align = ClangASTType::GetTypeBitAlign(ast_context, member_type);
-                uint64_t member_bit_incr = ((member_bit_size + member_bit_align - 1) / member_bit_align) * member_bit_align;
-                if (member_bit_incr % 8)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat("Array increment is not byte aligned");
-                    return false;
-                }
-                int64_t member_offset = (int64_t)(member_bit_incr / 8) * index;
-                
-                Value member;
-                
-                member.SetContext(Value::eContextTypeClangType, member_type);
-                member.SetValueType(array_val.GetValueType());
-                
-                addr_t array_base = (addr_t)array_val.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                addr_t member_loc = array_base + member_offset;
-                member.GetScalar() = (uint64_t)member_loc;
-                
-                stack.push_back(member);
-            }
-                break;
-                
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_uninit
-        // OPERANDS: none
-        // DESCRIPTION: Lets us know that the value is currently not initialized
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_uninit:
-            //return eResultTypeErrorUninitialized;
-            break;  // Ignore this as we have seen cases where this value is incorrectly added
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_assign
-        // OPERANDS: none
-        // DESCRIPTION: Pops a value off of the stack and assigns it to the next
-        // item on the stack which must be something assignable (inferior
-        // Variable, inferior Type with address, inferior register, or
-        // expression local variable.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_assign:
-            if (stack.size() < 2)
-            {
-                if (error_ptr)
-                    error_ptr->SetErrorString("Expression stack needs at least 2 items for DW_OP_APPLE_assign.");
-                return false;
-            }
-            else
-            {
-                tmp = stack.back();
-                stack.pop_back();
-                Value::ContextType context_type = stack.back().GetContextType();
-                StreamString new_value(Stream::eBinary, 4, lldb::endian::InlHostByteOrder());
-                switch (context_type)
-                {
-                case Value::eContextTypeClangType:
-                    {
-                        void *clang_type = stack.back().GetClangType();
-                        
-                        if (ClangASTContext::IsAggregateType (clang_type))
-                        {
-                            Value::ValueType source_value_type = tmp.GetValueType();
-                            Value::ValueType target_value_type = stack.back().GetValueType();
-                            
-                            addr_t source_addr = (addr_t)tmp.GetScalar().ULongLong();
-                            addr_t target_addr = (addr_t)stack.back().GetScalar().ULongLong();
-                            
-                            const uint64_t byte_size = ClangASTType::GetTypeByteSize(ast_context, clang_type);
-                            
-                            switch (source_value_type)
-                            {
-                            case Value::eValueTypeScalar:
-                            case Value::eValueTypeFileAddress:
-                                break;
-
-                            case Value::eValueTypeLoadAddress:
-                                switch (target_value_type)
-                                {
-                                case Value::eValueTypeLoadAddress:
-                                    {
-                                        DataBufferHeap data;
-                                        data.SetByteSize(byte_size);
-                                        
-                                        Error error;
-                                        if (process->ReadMemory (source_addr, data.GetBytes(), byte_size, error) != byte_size)
-                                        {
-                                            if (error_ptr)
-                                                error_ptr->SetErrorStringWithFormat ("Couldn't read a composite type from the target: %s", error.AsCString());
-                                            return false;
-                                        }
-                                        
-                                        if (process->WriteMemory (target_addr, data.GetBytes(), byte_size, error) != byte_size)
-                                        {
-                                            if (error_ptr)
-                                                error_ptr->SetErrorStringWithFormat ("Couldn't write a composite type to the target: %s", error.AsCString());
-                                            return false;
-                                        }
-                                    }
-                                    break;
-                                case Value::eValueTypeHostAddress:
-                                    if (process->GetByteOrder() != lldb::endian::InlHostByteOrder())
-                                    {
-                                        if (error_ptr)
-                                            error_ptr->SetErrorStringWithFormat ("Copy of composite types between incompatible byte orders is unimplemented");
-                                        return false;
-                                    }
-                                    else
-                                    {
-                                        Error error;
-                                        if (process->ReadMemory (source_addr, (uint8_t*)target_addr, byte_size, error) != byte_size)
-                                        {
-                                            if (error_ptr)
-                                                error_ptr->SetErrorStringWithFormat ("Couldn't read a composite type from the target: %s", error.AsCString());
-                                            return false;
-                                        }
-                                    }
-                                    break;
-                                default:
-                                    return false;
-                                }
-                                break;
-                            case Value::eValueTypeHostAddress:
-                                switch (target_value_type)
-                                {
-                                case Value::eValueTypeLoadAddress:
-                                    if (process->GetByteOrder() != lldb::endian::InlHostByteOrder())
-                                    {
-                                        if (error_ptr)
-                                            error_ptr->SetErrorStringWithFormat ("Copy of composite types between incompatible byte orders is unimplemented");
-                                        return false;
-                                    }
-                                    else
-                                    {
-                                        Error error;
-                                        if (process->WriteMemory (target_addr, (uint8_t*)source_addr, byte_size, error) != byte_size)
-                                        {
-                                            if (error_ptr)
-                                                error_ptr->SetErrorStringWithFormat ("Couldn't write a composite type to the target: %s", error.AsCString());
-                                            return false;
-                                        }
-                                    }
-                                case Value::eValueTypeHostAddress:
-                                    memcpy ((uint8_t*)target_addr, (uint8_t*)source_addr, byte_size);
-                                    break;
-                                default:
-                                    return false;
-                                }
-                            }
-                        }
-                        else
-                        {
-                            if (!ClangASTType::SetValueFromScalar (ast_context,
-                                                                  clang_type,
-                                                                  tmp.ResolveValue(exe_ctx, ast_context),
-                                                                  new_value))
-                            {
-                                if (error_ptr)
-                                    error_ptr->SetErrorStringWithFormat ("Couldn't extract a value from an integral type.\n");
-                                return false;
-                            }
-                                
-                            Value::ValueType value_type = stack.back().GetValueType();
-                            
-                            switch (value_type)
-                            {
-                            case Value::eValueTypeLoadAddress:
-                            case Value::eValueTypeHostAddress:
-                                {
-                                    AddressType address_type = (value_type == Value::eValueTypeLoadAddress ? eAddressTypeLoad : eAddressTypeHost);
-                                    lldb::addr_t addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                                    if (!ClangASTType::WriteToMemory (ast_context,
-                                                                          clang_type,
-                                                                          exe_ctx,
-                                                                          addr,
-                                                                          address_type,
-                                                                          new_value))
-                                    {
-                                        if (error_ptr)
-                                            error_ptr->SetErrorStringWithFormat ("Failed to write value to memory at 0x%" PRIx64 ".\n", addr);
-                                        return false;
-                                    }
-                                }
-                                break;
-
-                            default:
-                                break;
-                            }
-                        }
-                    }
-                    break;
-
-                default:
-                    if (error_ptr)
-                        error_ptr->SetErrorString ("Assign failed.");
-                    return false;
-                }
-            }
-            break;
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_address_of
-        // OPERANDS: none
-        // DESCRIPTION: Pops a value off of the stack and pushed its address.
-        // The top item on the stack must be a variable, or already be a memory
-        // location.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_address_of:
-            if (stack.empty())
-            {
-                if (error_ptr)
-                    error_ptr->SetErrorString("Expression stack needs at least 1 item for DW_OP_APPLE_address_of.");
-                return false;
-            }
-            else
-            {
-                Value::ValueType value_type = stack.back().GetValueType();
-                switch (value_type)
-                {
-                default:
-                case Value::eValueTypeScalar:      // raw scalar value
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Top stack item isn't a memory based object.");
-                    return false;
-
-                case Value::eValueTypeLoadAddress: // load address value
-                case Value::eValueTypeFileAddress: // file address value
-                case Value::eValueTypeHostAddress: // host address value (for memory in the process that is using liblldb)
-                    // Taking the address of an object reduces it to the address
-                    // of the value and removes any extra context it had.
-                    //stack.back().SetValueType(Value::eValueTypeScalar);
-                    stack.back().ClearContext();
-                    break;
-                }
-            }
-            break;
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_value_of
-        // OPERANDS: none
-        // DESCRIPTION: Pops a value off of the stack and pushed its value.
-        // The top item on the stack must be a variable, expression variable.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_value_of:
-            if (stack.empty())
-            {
-                if (error_ptr)
-                    error_ptr->SetErrorString("Expression stack needs at least 1 items for DW_OP_APPLE_value_of.");
-                return false;
-            }
-            else if (!stack.back().ValueOf(exe_ctx, ast_context))
-            {
-                if (error_ptr)
-                    error_ptr->SetErrorString ("Top stack item isn't a valid candidate for DW_OP_APPLE_value_of.");
-                return false;
-            }
-            break;
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_deref_type
-        // OPERANDS: none
-        // DESCRIPTION: gets the value pointed to by the top stack item
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_deref_type:
-            {
-                if (stack.empty())
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Expression stack needs at least 1 items for DW_OP_APPLE_deref_type.");
-                    return false;
-                }
-                    
-                tmp = stack.back();
-                stack.pop_back();
-                
-                if (tmp.GetContextType() != Value::eContextTypeClangType)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Item at top of expression stack must have a Clang type");
-                    return false;
-                }
-                    
-                void *ptr_type = tmp.GetClangType();
-                void *target_type;
-            
-                if (!ClangASTContext::IsPointerType(ptr_type, &target_type))
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Dereferencing a non-pointer type");
-                    return false;
-                }
-                
-                // TODO do we want all pointers to be dereferenced as load addresses?
-                Value::ValueType value_type = tmp.GetValueType();
-                
-                tmp.ResolveValue(exe_ctx, ast_context);
-                
-                tmp.SetValueType(value_type);
-                tmp.SetContext(Value::eContextTypeClangType, target_type);
-                
-                stack.push_back(tmp);
-            }
-            break;
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_expr_local
-        // OPERANDS: ULEB128
-        // DESCRIPTION: pushes the expression local variable index onto the
-        // stack and set the appropriate context so we know the stack item is
-        // an expression local variable index.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_expr_local:
-            {
-                /*
-                uint32_t idx = opcodes.GetULEB128(&offset);
-                if (expr_locals == NULL)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat ("DW_OP_APPLE_expr_local(%u) opcode encountered with no local variable list.\n", idx);
-                    return false;
-                }
-                Value *expr_local_variable = expr_locals->GetVariableAtIndex(idx);
-                if (expr_local_variable == NULL)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat ("DW_OP_APPLE_expr_local(%u) with invalid index %u.\n", idx, idx);
-                    return false;
-                }
-                 // The proxy code has been removed. If it is ever re-added, please
-                 // use shared pointers or return by value to avoid possible memory
-                 // leak (there is no leak here, but in general, no returning pointers
-                 // that must be manually freed please.
-                Value *proxy = expr_local_variable->CreateProxy();
-                stack.push_back(*proxy);
-                delete proxy;
-                //stack.back().SetContext (Value::eContextTypeClangType, expr_local_variable->GetClangType());
-                */
-            }
-            break;
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_extern
-        // OPERANDS: ULEB128
-        // DESCRIPTION: pushes a proxy for the extern object index onto the
-        // stack.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_extern:
-            {
-                /*
-                uint32_t idx = opcodes.GetULEB128(&offset);
-                if (!decl_map)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat ("DW_OP_APPLE_extern(%u) opcode encountered with no decl map.\n", idx);
-                    return false;
-                }
-                Value *extern_var = decl_map->GetValueForIndex(idx);
-                if (!extern_var)
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat ("DW_OP_APPLE_extern(%u) with invalid index %u.\n", idx, idx);
-                    return false;
-                }
-                // The proxy code has been removed. If it is ever re-added, please
-                // use shared pointers or return by value to avoid possible memory
-                // leak (there is no leak here, but in general, no returning pointers
-                // that must be manually freed please.
-                Value *proxy = extern_var->CreateProxy();
-                stack.push_back(*proxy);
-                delete proxy;
-                */
-            }
-            break;
-
-        case DW_OP_APPLE_scalar_cast:
-            if (stack.empty())
-            {
-                if (error_ptr)
-                    error_ptr->SetErrorString("Expression stack needs at least 1 item for DW_OP_APPLE_scalar_cast.");
-                return false;
-            }
-            else
-            {
-                // Simple scalar cast
-                if (!stack.back().ResolveValue(exe_ctx, ast_context).Cast((Scalar::Type)opcodes.GetU8(&offset)))
-                {
-                    if (error_ptr)
-                        error_ptr->SetErrorString("Cast failed.");
-                    return false;
-                }
-            }
-            break;
-
-
-        case DW_OP_APPLE_clang_cast:
-            if (stack.empty())
-            {
-                if (error_ptr)
-                    error_ptr->SetErrorString("Expression stack needs at least 1 item for DW_OP_APPLE_clang_cast.");
-                return false;
-            }
-            else
-            {
-                void *clang_type = (void *)opcodes.GetMaxU64(&offset, sizeof(void*));
-                stack.back().SetContext (Value::eContextTypeClangType, clang_type);
-            }
-            break;
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_constf
-        // OPERANDS: 1 byte float length, followed by that many bytes containing
-        // the constant float data.
-        // DESCRIPTION: Push a float value onto the expression stack.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_constf:        // 0xF6 - 1 byte float size, followed by constant float data
-            {
-                uint8_t float_length = opcodes.GetU8(&offset);
-                if (sizeof(float) == float_length)
-                    tmp.ResolveValue(exe_ctx, ast_context) = opcodes.GetFloat (&offset);
-                else if (sizeof(double) == float_length)
-                    tmp.ResolveValue(exe_ctx, ast_context) = opcodes.GetDouble (&offset);
-                else if (sizeof(long double) == float_length)
-                    tmp.ResolveValue(exe_ctx, ast_context) = opcodes.GetLongDouble (&offset);
-                else
-                {
-                    StreamString new_value;
-                    opcodes.Dump(&new_value, offset, eFormatBytes, 1, float_length, UINT32_MAX, DW_INVALID_ADDRESS, 0, 0);
-
-                     if (error_ptr)
-                        error_ptr->SetErrorStringWithFormat ("DW_OP_APPLE_constf(<%u> %s) unsupported float size.\n", float_length, new_value.GetData());
-                    return false;
-               }
-               tmp.SetValueType(Value::eValueTypeScalar);
-               tmp.ClearContext();
-               stack.push_back(tmp);
-            }
-            break;
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_clear
-        // OPERANDS: none
-        // DESCRIPTION: Clears the expression stack.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_clear:
-            stack.clear();
-            break;
-
-        //----------------------------------------------------------------------
-        // OPCODE: DW_OP_APPLE_error
-        // OPERANDS: none
-        // DESCRIPTION: Pops a value off of the stack and pushed its value.
-        // The top item on the stack must be a variable, expression variable.
-        //----------------------------------------------------------------------
-        case DW_OP_APPLE_error:         // 0xFF - Stops expression evaluation and returns an error (no args)
-            if (error_ptr)
-                error_ptr->SetErrorString ("Generic error.");
-            return false;
-#endif // #if 0
-                
         }
     }
 

Modified: lldb/branches/lldb-platform-work/source/Expression/ExpressionSourceCode.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ExpressionSourceCode.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ExpressionSourceCode.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ExpressionSourceCode.cpp Wed Jul 17 17:17:41 2013
@@ -70,8 +70,8 @@ bool ExpressionSourceCode::GetText (std:
                                "{                              \n"
                                "    %s;                        \n" 
                                "}                              \n",
-                               m_prefix.c_str(),
                                g_expression_prefix,
+                               m_prefix.c_str(),
                                m_name.c_str(),
                                m_body.c_str());
             break;
@@ -83,8 +83,8 @@ bool ExpressionSourceCode::GetText (std:
                                "{                                      \n"
                                "    %s;                                \n" 
                                "}                                      \n",
-                               m_prefix.c_str(),
                                g_expression_prefix,
+                               m_prefix.c_str(),
                                m_name.c_str(),
                                (const_object ? "const" : ""),
                                m_body.c_str());
@@ -103,8 +103,8 @@ bool ExpressionSourceCode::GetText (std:
                                    "    %s;                                                 \n"
                                    "}                                                       \n"
                                    "@end                                                    \n",
-                                   m_prefix.c_str(),
                                    g_expression_prefix,
+                                   m_prefix.c_str(),
                                    m_name.c_str(),
                                    m_name.c_str(),
                                    m_body.c_str());
@@ -122,8 +122,8 @@ bool ExpressionSourceCode::GetText (std:
                                    "    %s;                                                \n"
                                    "}                                                      \n"
                                    "@end                                                   \n",
-                                   m_prefix.c_str(),
                                    g_expression_prefix,
+                                   m_prefix.c_str(),
                                    m_name.c_str(),
                                    m_name.c_str(),
                                    m_body.c_str());

Modified: lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp Wed Jul 17 17:17:41 2013
@@ -33,6 +33,7 @@
 #include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Host/Endian.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangASTType.h"
 
 #include <map>
 
@@ -130,7 +131,7 @@ PrintValue(const Value *value, bool trun
 }
 
 static std::string
-PrintType(const Type *type, bool truncate = false)
+PrintType(const llvm::Type *type, bool truncate = false)
 {
     std::string s;
     raw_string_ostream rso(s);
@@ -565,7 +566,7 @@ IRForTarget::CreateResultVariable (llvm:
                                                      &result_decl->getASTContext());
     }
     
-    if (m_result_type.GetClangTypeBitWidth() == 0)
+    if (m_result_type.GetBitSize() == 0)
     {
         lldb_private::StreamString type_desc_stream;
         m_result_type.DumpTypeDescription(&type_desc_stream);
@@ -592,7 +593,7 @@ IRForTarget::CreateResultVariable (llvm:
     if (log)
         log->Printf("Creating a new result global: \"%s\" with size 0x%" PRIx64,
                     m_result_name.GetCString(),
-                    m_result_type.GetClangTypeBitWidth() / 8);
+                    m_result_type.GetByteSize());
         
     // Construct a new result global and set up its metadata
     
@@ -1496,22 +1497,14 @@ IRForTarget::MaybeHandleVariable (Value
         
         std::string name (named_decl->getName().str());
         
-        void *opaque_type = NULL;
-        clang::ASTContext *ast_context = NULL;
-        
-        if (clang::ValueDecl *value_decl = dyn_cast<clang::ValueDecl>(named_decl))
-        {
-            opaque_type = value_decl->getType().getAsOpaquePtr();
-            ast_context = &value_decl->getASTContext();
-        }
-        else
-        {
+        clang::ValueDecl *value_decl = dyn_cast<clang::ValueDecl>(named_decl);
+        if (value_decl == NULL)
             return false;
-        }
+
+        lldb_private::ClangASTType clang_type(&value_decl->getASTContext(), value_decl->getType());
         
-        clang::QualType qual_type;
         const Type *value_type = NULL;
-        
+
         if (name[0] == '$')
         {
             // The $__lldb_expr_result name indicates the the return value has allocated as
@@ -1523,26 +1516,26 @@ IRForTarget::MaybeHandleVariable (Value
             // to the type of $__lldb_expr_result, not the type itself.
             //
             // We also do this for any user-declared persistent variables.
-            
-            qual_type = ast_context->getPointerType(clang::QualType::getFromOpaquePtr(opaque_type));
+            clang_type = clang_type.GetPointerType();
             value_type = PointerType::get(global_variable->getType(), 0);
         }
         else
         {
-            qual_type = clang::QualType::getFromOpaquePtr(opaque_type);
             value_type = global_variable->getType();
         }
-                
-        uint64_t value_size = (ast_context->getTypeSize(qual_type) + 7ull) / 8ull;
-        off_t value_alignment = (ast_context->getTypeAlign(qual_type) + 7ull) / 8ull;
+        
+        const uint64_t value_size = clang_type.GetByteSize();
+        off_t value_alignment = (clang_type.GetTypeBitAlign() + 7ull) / 8ull;
         
         if (log)
+        {
             log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64 ", align %" PRId64 "]",
                         name.c_str(), 
-                        qual_type.getAsString().c_str(), 
-                        PrintType(value_type).c_str(), 
+                        clang_type.GetQualType().getAsString().c_str(),
+                        PrintType(value_type).c_str(),
                         value_size, 
                         value_alignment);
+        }
         
         
         if (named_decl && !m_decl_map->AddValueToStruct(named_decl,
@@ -2217,7 +2210,8 @@ IRForTarget::UnfoldConstant(Constant *ol
                                                    llvm::cast<Instruction>(entry_instruction_finder.GetValue(function)));
                         });
                         
-                        return UnfoldConstant(constant_expr, bit_cast_maker, entry_instruction_finder);
+                        if (!UnfoldConstant(constant_expr, bit_cast_maker, entry_instruction_finder))
+                            return false;
                     }
                     break;
                 case Instruction::GetElementPtr:
@@ -2254,7 +2248,8 @@ IRForTarget::UnfoldConstant(Constant *ol
                             return GetElementPtrInst::Create(ptr, indices, "", llvm::cast<Instruction>(entry_instruction_finder.GetValue(function)));
                         });
                         
-                        return UnfoldConstant(constant_expr, get_element_pointer_maker, entry_instruction_finder);
+                        if (!UnfoldConstant(constant_expr, get_element_pointer_maker, entry_instruction_finder))
+                            return false;
                     }
                     break;
                 }
@@ -2281,6 +2276,11 @@ IRForTarget::UnfoldConstant(Constant *ol
         }
     }
     
+    if (!isa<GlobalValue>(old_constant))
+    {
+        old_constant->destroyConstant();
+    }
+    
     return true;
 }
 

Modified: lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp Wed Jul 17 17:17:41 2013
@@ -49,7 +49,7 @@ Materializer::AddStructMember (Entity &e
 void
 Materializer::Entity::SetSizeAndAlignmentFromType (ClangASTType &type)
 {
-    m_size = type.GetTypeByteSize();
+    m_size = type.GetByteSize();
     
     uint32_t bit_alignment = type.GetTypeBitAlign();
     
@@ -100,8 +100,7 @@ public:
         // Put the location of the spare memory into the live data of the ValueObject.
                 
         m_persistent_variable_sp->m_live_sp = ValueObjectConstResult::Create (map.GetBestExecutionContextScope(),
-                                                                              m_persistent_variable_sp->GetTypeFromUser().GetASTContext(),
-                                                                              m_persistent_variable_sp->GetTypeFromUser().GetOpaqueQualType(),
+                                                                              m_persistent_variable_sp->GetTypeFromUser(),
                                                                               m_persistent_variable_sp->GetName(),
                                                                               mem,
                                                                               eAddressTypeLoad,
@@ -151,10 +150,12 @@ public:
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
+        const lldb::addr_t load_addr = process_address + m_offset;
+    
         if (log)
         {
-            log->Printf("EntityPersistentVariable::Materialize [process_address = 0x%" PRIx64 ", m_name = %s, m_flags = 0x%hx]",
-                        (uint64_t)process_address,
+            log->Printf("EntityPersistentVariable::Materialize [address = 0x%" PRIx64 ", m_name = %s, m_flags = 0x%hx]",
+                        (uint64_t)load_addr,
                         m_persistent_variable_sp->GetName().AsCString(),
                         m_persistent_variable_sp->m_flags);
         }
@@ -173,7 +174,7 @@ public:
         {
             Error write_error;
                         
-            map.WriteScalarToMemory(process_address + m_offset,
+            map.WriteScalarToMemory(load_addr,
                                     m_persistent_variable_sp->m_live_sp->GetValue().GetScalar(),
                                     map.GetAddressByteSize(),
                                     write_error);
@@ -190,15 +191,21 @@ public:
         }
     }
     
-    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp,
+                        IRMemoryMap &map,
+                        lldb::addr_t process_address,
+                        lldb::addr_t frame_top,
+                        lldb::addr_t frame_bottom,
+                        Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
+        const lldb::addr_t load_addr = process_address + m_offset;
+
         if (log)
         {
-            log->Printf("EntityPersistentVariable::Dematerialize [process_address = 0x%" PRIx64 ", m_name = %s, m_flags = 0x%hx]",
-                        (uint64_t)process_address,
+            log->Printf("EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64 ", m_name = %s, m_flags = 0x%hx]",
+                        (uint64_t)process_address + m_offset,
                         m_persistent_variable_sp->GetName().AsCString(),
                         m_persistent_variable_sp->m_flags);
         }
@@ -215,7 +222,7 @@ public:
                 lldb::addr_t location;
                 Error read_error;
                 
-                map.ReadPointerFromMemory(&location, process_address + m_offset, read_error);
+                map.ReadPointerFromMemory(&location, load_addr, read_error);
                                 
                 if (!read_error.Success())
                 {
@@ -224,8 +231,7 @@ public:
                 }
                                 
                 m_persistent_variable_sp->m_live_sp = ValueObjectConstResult::Create (map.GetBestExecutionContextScope (),
-                                                                                      m_persistent_variable_sp->GetTypeFromUser().GetASTContext(),
-                                                                                      m_persistent_variable_sp->GetTypeFromUser().GetOpaqueQualType(),
+                                                                                      m_persistent_variable_sp->GetTypeFromUser(),
                                                                                       m_persistent_variable_sp->GetName(),
                                                                                       location,
                                                                                       eAddressTypeLoad,
@@ -319,14 +325,16 @@ public:
         
         Error err;
         
-        dump_stream.Printf("0x%" PRIx64 ": EntityPersistentVariable (%s)\n", process_address + m_offset, m_persistent_variable_sp->GetName().AsCString());
+        const lldb::addr_t load_addr = process_address + m_offset;
+
+        dump_stream.Printf("0x%" PRIx64 ": EntityPersistentVariable (%s)\n", load_addr, m_persistent_variable_sp->GetName().AsCString());
         
         {
             dump_stream.Printf("Pointer:\n");
             
             DataBufferHeap data (m_size, 0);
             
-            map.ReadMemory(data.GetBytes(), process_address + m_offset, m_size, err);
+            map.ReadMemory(data.GetBytes(), load_addr, m_size, err);
             
             if (!err.Success())
             {
@@ -336,7 +344,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 dump_stream.PutChar('\n');
             }
@@ -347,7 +355,7 @@ public:
             
             lldb::addr_t target_address;
             
-            map.ReadPointerFromMemory (&target_address, process_address + m_offset, err);
+            map.ReadPointerFromMemory (&target_address, load_addr, err);
                         
             if (!err.Success())
             {
@@ -407,17 +415,18 @@ public:
         // Hard-coding to maximum size of a pointer since all variables are materialized by reference
         m_size = 8;
         m_alignment = 8;
-        m_is_reference = ClangASTContext::IsReferenceType(m_variable_sp->GetType()->GetClangForwardType());
+        m_is_reference = m_variable_sp->GetType()->GetClangForwardType().IsReferenceType();
     }
     
     void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
+        const lldb::addr_t load_addr = process_address + m_offset;
         if (log)
         {
-            log->Printf("EntityVariable::Materialize [process_address = 0x%" PRIx64 ", m_variable_sp = %s]",
-                        (uint64_t)process_address,
+            log->Printf("EntityVariable::Materialize [address = 0x%" PRIx64 ", m_variable_sp = %s]",
+                        (uint64_t)load_addr,
                         m_variable_sp->GetName().AsCString());
         }
         
@@ -442,7 +451,7 @@ public:
             lldb::addr_t reference_addr = valobj_extractor.GetAddress(&offset);
             
             Error write_error;
-            map.WritePointerToMemory(process_address + m_offset, reference_addr, write_error);
+            map.WritePointerToMemory(load_addr, reference_addr, write_error);
             
             if (!write_error.Success())
             {
@@ -462,7 +471,7 @@ public:
                 lldb::addr_t addr_of_valobj_addr = valobj_extractor.GetAddress(&offset);
                 
                 Error write_error;
-                map.WritePointerToMemory(process_address + m_offset, addr_of_valobj_addr, write_error);
+                map.WritePointerToMemory(load_addr, addr_of_valobj_addr, write_error);
                 
                 if (!write_error.Success())
                 {
@@ -494,7 +503,7 @@ public:
                     return;
                 }
                 
-                size_t bit_align = ClangASTType::GetTypeBitAlign(m_variable_sp->GetType()->GetClangAST(), m_variable_sp->GetType()->GetClangLayoutType());
+                size_t bit_align = m_variable_sp->GetType()->GetClangLayoutType().GetTypeBitAlign();
                 size_t byte_align = (bit_align + 7) / 8;
                 
                 Error alloc_error;
@@ -520,7 +529,7 @@ public:
                 
                 Error pointer_write_error;
                 
-                map.WritePointerToMemory(process_address + m_offset, m_temporary_allocation, pointer_write_error);
+                map.WritePointerToMemory(load_addr, m_temporary_allocation, pointer_write_error);
                 
                 if (!pointer_write_error.Success())
                 {
@@ -530,15 +539,20 @@ public:
         }
     }
     
-    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp,
+                        IRMemoryMap &map,
+                        lldb::addr_t process_address,
+                        lldb::addr_t frame_top,
+                        lldb::addr_t frame_bottom,
+                        Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
+        const lldb::addr_t load_addr = process_address + m_offset;
         if (log)
         {
-            log->Printf("EntityVariable::Dematerialize [process_address = 0x%" PRIx64 ", m_variable_sp = %s]",
-                        (uint64_t)process_address,
+            log->Printf("EntityVariable::Dematerialize [address = 0x%" PRIx64 ", m_variable_sp = %s]",
+                        (uint64_t)load_addr,
                         m_variable_sp->GetName().AsCString());
         }
         
@@ -597,8 +611,9 @@ public:
     void DumpToLog (IRMemoryMap &map, lldb::addr_t process_address, Log *log)
     {
         StreamString dump_stream;
-        
-        dump_stream.Printf("0x%" PRIx64 ": EntityVariable\n", process_address + m_offset);
+
+        const lldb::addr_t load_addr = process_address + m_offset;
+        dump_stream.Printf("0x%" PRIx64 ": EntityVariable\n", load_addr);
         
         Error err;
                 
@@ -609,7 +624,7 @@ public:
             
             DataBufferHeap data (m_size, 0);
             
-            map.ReadMemory(data.GetBytes(), process_address + m_offset, m_size, err);
+            map.ReadMemory(data.GetBytes(), load_addr, m_size, err);
             
             if (!err.Success())
             {
@@ -619,7 +634,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 lldb::offset_t offset;
                 
@@ -656,7 +671,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 dump_stream.PutChar('\n');
             }
@@ -721,7 +736,9 @@ public:
                 return;
             }
             
-            size_t byte_size = m_type.GetTypeByteSize();
+            const lldb::addr_t load_addr = process_address + m_offset;
+
+            size_t byte_size = m_type.GetByteSize();
             size_t bit_align = m_type.GetTypeBitAlign();
             size_t byte_align = (bit_align + 7) / 8;
             
@@ -738,7 +755,7 @@ public:
                         
             Error pointer_write_error;
             
-            map.WritePointerToMemory(process_address + m_offset, m_temporary_allocation, pointer_write_error);
+            map.WritePointerToMemory(load_addr, m_temporary_allocation, pointer_write_error);
             
             if (!pointer_write_error.Success())
             {
@@ -747,15 +764,23 @@ public:
         }
     }
     
-    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp,
+                        IRMemoryMap &map,
+                        lldb::addr_t process_address,
+                        lldb::addr_t frame_top,
+                        lldb::addr_t frame_bottom,
+                        Error &err)
     {
         err.SetErrorString("Tried to detmaterialize a result variable with the normal Dematerialize method");
     }
     
     void Dematerialize (lldb::ClangExpressionVariableSP &result_variable_sp,
-                        lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+                        lldb::StackFrameSP &frame_sp,
+                        IRMemoryMap &map,
+                        lldb::addr_t process_address,
+                        lldb::addr_t frame_top,
+                        lldb::addr_t frame_bottom,
+                        Error &err)
     {
         err.Clear();
         
@@ -769,8 +794,9 @@ public:
         
         lldb::addr_t address;
         Error read_error;
+        const lldb::addr_t load_addr = process_address + m_offset;
         
-        map.ReadPointerFromMemory (&address, process_address + m_offset, read_error);
+        map.ReadPointerFromMemory (&address, load_addr, read_error);
         
         if (!read_error.Success())
         {
@@ -809,8 +835,7 @@ public:
         if (can_persist && m_keep_in_memory)
         {
             ret->m_live_sp = ValueObjectConstResult::Create(exe_scope,
-                                                            m_type.GetASTContext(),
-                                                            m_type.GetOpaqueQualType(),
+                                                            m_type,
                                                             name,
                                                             address,
                                                             eAddressTypeLoad,
@@ -854,8 +879,10 @@ public:
     void DumpToLog (IRMemoryMap &map, lldb::addr_t process_address, Log *log)
     {
         StreamString dump_stream;
-                
-        dump_stream.Printf("0x%" PRIx64 ": EntityResultVariable\n", process_address + m_offset);
+        
+        const lldb::addr_t load_addr = process_address + m_offset;
+
+        dump_stream.Printf("0x%" PRIx64 ": EntityResultVariable\n", load_addr);
         
         Error err;
         
@@ -866,7 +893,7 @@ public:
             
             DataBufferHeap data (m_size, 0);
             
-            map.ReadMemory(data.GetBytes(), process_address + m_offset, m_size, err);
+            map.ReadMemory(data.GetBytes(), load_addr, m_size, err);
             
             if (!err.Success())
             {
@@ -876,7 +903,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 lldb::offset_t offset;
                 
@@ -913,7 +940,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 dump_stream.PutChar('\n');
             }
@@ -970,10 +997,12 @@ public:
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
+        const lldb::addr_t load_addr = process_address + m_offset;
+
         if (log)
         {
-            log->Printf("EntitySymbol::Materialize [process_address = 0x%" PRIx64 ", m_symbol = %s]",
-                        (uint64_t)process_address,
+            log->Printf("EntitySymbol::Materialize [address = 0x%" PRIx64 ", m_symbol = %s]",
+                        (uint64_t)load_addr,
                         m_symbol.GetName().AsCString());
         }
         
@@ -999,7 +1028,7 @@ public:
         
         Error pointer_write_error;
         
-        map.WritePointerToMemory(process_address + m_offset, resolved_address, pointer_write_error);
+        map.WritePointerToMemory(load_addr, resolved_address, pointer_write_error);
         
         if (!pointer_write_error.Success())
         {
@@ -1008,15 +1037,21 @@ public:
         }
     }
     
-    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp,
+                        IRMemoryMap &map,
+                        lldb::addr_t process_address,
+                        lldb::addr_t frame_top,
+                        lldb::addr_t frame_bottom,
+                        Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
+        const lldb::addr_t load_addr = process_address + m_offset;
+
         if (log)
         {
-            log->Printf("EntitySymbol::Dematerialize [process_address = 0x%" PRIx64 ", m_symbol = %s]",
-                        (uint64_t)process_address,
+            log->Printf("EntitySymbol::Dematerialize [address = 0x%" PRIx64 ", m_symbol = %s]",
+                        (uint64_t)load_addr,
                         m_symbol.GetName().AsCString());
         }
         
@@ -1029,14 +1064,16 @@ public:
         
         Error err;
         
-        dump_stream.Printf("0x%" PRIx64 ": EntitySymbol (%s)\n", process_address + m_offset, m_symbol.GetName().AsCString());
+        const lldb::addr_t load_addr = process_address + m_offset;
+
+        dump_stream.Printf("0x%" PRIx64 ": EntitySymbol (%s)\n", load_addr, m_symbol.GetName().AsCString());
         
         {
             dump_stream.Printf("Pointer:\n");
             
             DataBufferHeap data (m_size, 0);
             
-            map.ReadMemory(data.GetBytes(), process_address + m_offset, m_size, err);
+            map.ReadMemory(data.GetBytes(), load_addr, m_size, err);
             
             if (!err.Success())
             {
@@ -1046,7 +1083,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 dump_stream.PutChar('\n');
             }
@@ -1088,10 +1125,12 @@ public:
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
+        const lldb::addr_t load_addr = process_address + m_offset;
+
         if (log)
         {
-            log->Printf("EntityRegister::Materialize [process_address = 0x%" PRIx64 ", m_register_info = %s]",
-                        (uint64_t)process_address,
+            log->Printf("EntityRegister::Materialize [address = 0x%" PRIx64 ", m_register_info = %s]",
+                        (uint64_t)load_addr,
                         m_register_info.name);
         }
 
@@ -1125,9 +1164,11 @@ public:
             return;
         }
         
+        m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize()));
+        
         Error write_error;
         
-        map.WriteMemory(process_address + m_offset, register_data.GetDataStart(), register_data.GetByteSize(), write_error);
+        map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error);
         
         if (!write_error.Success())
         {
@@ -1136,15 +1177,21 @@ public:
         }
     }
     
-    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp,
+                        IRMemoryMap &map,
+                        lldb::addr_t process_address,
+                        lldb::addr_t frame_top,
+                        lldb::addr_t frame_bottom,
+                        Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
+        const lldb::addr_t load_addr = process_address + m_offset;
+
         if (log)
         {
-            log->Printf("EntityRegister::Dematerialize [process_address = 0x%" PRIx64 ", m_register_info = %s]",
-                        (uint64_t)process_address,
+            log->Printf("EntityRegister::Dematerialize [address = 0x%" PRIx64 ", m_register_info = %s]",
+                        (uint64_t)load_addr,
                         m_register_info.name);
         }
         
@@ -1160,7 +1207,7 @@ public:
         
         lldb::RegisterContextSP reg_context_sp = frame_sp->GetRegisterContext();
         
-        map.GetMemoryData(register_data, process_address + m_offset, m_register_info.byte_size, extract_error);
+        map.GetMemoryData(register_data, load_addr, m_register_info.byte_size, extract_error);
         
         if (!extract_error.Success())
         {
@@ -1168,6 +1215,16 @@ public:
             return;
         }
         
+        if (!memcmp(register_data.GetDataStart(), m_register_contents->GetBytes(), register_data.GetByteSize()))
+        {
+            // No write required, and in particular we avoid errors if the register wasn't writable
+            
+            m_register_contents.reset();
+            return;
+        }
+        
+        m_register_contents.reset();
+        
         RegisterValue register_value (const_cast<uint8_t*>(register_data.GetDataStart()), register_data.GetByteSize(), register_data.GetByteOrder());
         
         if (!reg_context_sp->WriteRegister(&m_register_info, register_value))
@@ -1183,14 +1240,17 @@ public:
         
         Error err;
         
-        dump_stream.Printf("0x%" PRIx64 ": EntityRegister (%s)\n", process_address + m_offset, m_register_info.name);
+        const lldb::addr_t load_addr = process_address + m_offset;
+
+        
+        dump_stream.Printf("0x%" PRIx64 ": EntityRegister (%s)\n", load_addr, m_register_info.name);
         
         {
             dump_stream.Printf("Value:\n");
             
             DataBufferHeap data (m_size, 0);
             
-            map.ReadMemory(data.GetBytes(), process_address + m_offset, m_size, err);
+            map.ReadMemory(data.GetBytes(), load_addr, m_size, err);
             
             if (!err.Success())
             {
@@ -1200,7 +1260,7 @@ public:
             {
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, load_addr);
                 
                 dump_stream.PutChar('\n');
             }
@@ -1214,6 +1274,7 @@ public:
     }
 private:
     RegisterInfo m_register_info;
+    lldb::DataBufferSP m_register_contents;
 };
 
 uint32_t

Modified: lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Host.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/common/Host.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/common/Host.cpp Wed Jul 17 17:17:41 2013
@@ -532,13 +532,13 @@ Host::ThreadCreated (const char *thread_
 void
 Host::Backtrace (Stream &strm, uint32_t max_frames)
 {
-    // TODO: Is there a way to backtrace the current process on linux? Other systems?
+    // TODO: Is there a way to backtrace the current process on other systems?
 }
 
 size_t
 Host::GetEnvironment (StringList &env)
 {
-    // TODO: Is there a way to the host environment for this process on linux? Other systems?
+    // TODO: Is there a way to the host environment for this process on other systems?
     return 0;
 }
 
@@ -629,40 +629,6 @@ Host::ThreadJoin (lldb::thread_t thread,
     return err == 0;
 }
 
-
-std::string
-Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid)
-{
-    std::string thread_name;
-#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
-    // We currently can only get the name of a thread in the current process.
-    if (pid == Host::GetCurrentProcessID())
-    {
-        char pthread_name[1024];
-        if (::pthread_getname_np (::pthread_from_mach_thread_np (tid), pthread_name, sizeof(pthread_name)) == 0)
-        {
-            if (pthread_name[0])
-            {
-                thread_name = pthread_name;
-            }
-        }
-        else
-        {
-            dispatch_queue_t current_queue = ::dispatch_get_current_queue ();
-            if (current_queue != NULL)
-            {
-                const char *queue_name = dispatch_queue_get_label (current_queue);
-                if (queue_name && queue_name[0])
-                {
-                    thread_name = queue_name;
-                }
-            }
-        }
-    }
-#endif
-    return thread_name;
-}
-
 bool
 Host::SetThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name)
 {
@@ -914,7 +880,7 @@ Host::GetLLDBPath (PathType path_type, F
     // To get paths related to LLDB we get the path to the executable that
     // contains this function. On MacOSX this will be "LLDB.framework/.../LLDB",
     // on linux this is assumed to be the "lldb" main executable. If LLDB on
-    // linux is actually in a shared library (lldb.so??) then this function will
+    // linux is actually in a shared library (liblldb.so) then this function will
     // need to be modified to "do the right thing".
 
     switch (path_type)
@@ -1042,12 +1008,13 @@ Host::GetLLDBPath (PathType path_type, F
 
     case ePathTypeLLDBSystemPlugins:    // System plug-ins directory
         {
-#if defined (__APPLE__)
+#if defined (__APPLE__) || defined(__linux__)
             static ConstString g_lldb_system_plugin_dir;
             static bool g_lldb_system_plugin_dir_located = false;
             if (!g_lldb_system_plugin_dir_located)
             {
                 g_lldb_system_plugin_dir_located = true;
+#if defined (__APPLE__)
                 FileSpec lldb_file_spec;
                 if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec))
                 {
@@ -1065,6 +1032,13 @@ Host::GetLLDBPath (PathType path_type, F
                     }
                     return false;
                 }
+#elif defined (__linux__)
+                FileSpec lldb_file_spec("/usr/lib/lldb", true);
+                if (lldb_file_spec.Exists())
+                {
+                    g_lldb_system_plugin_dir.SetCString(lldb_file_spec.GetPath().c_str());
+                }
+#endif // __APPLE__ || __linux__
             }
             
             if (g_lldb_system_plugin_dir)
@@ -1072,9 +1046,10 @@ Host::GetLLDBPath (PathType path_type, F
                 file_spec.GetDirectory() = g_lldb_system_plugin_dir;
                 return true;
             }
-#endif
-            // TODO: where would system LLDB plug-ins be located on linux? Other systems?
+#else
+            // TODO: where would system LLDB plug-ins be located on other systems?
             return false;
+#endif
         }
         break;
 
@@ -1094,8 +1069,39 @@ Host::GetLLDBPath (PathType path_type, F
             }
             file_spec.GetDirectory() = g_lldb_user_plugin_dir;
             return file_spec.GetDirectory();
+#elif defined (__linux__)
+            static ConstString g_lldb_user_plugin_dir;
+            if (!g_lldb_user_plugin_dir)
+            {
+                // XDG Base Directory Specification
+                // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+                // If XDG_DATA_HOME exists, use that, otherwise use ~/.local/share/lldb.
+                FileSpec lldb_file_spec;
+                const char *xdg_data_home = getenv("XDG_DATA_HOME");
+                if (xdg_data_home && xdg_data_home[0])
+                {
+                    std::string user_plugin_dir (xdg_data_home);
+                    user_plugin_dir += "/lldb";
+                    lldb_file_spec.SetFile (user_plugin_dir.c_str(), true);
+                }
+                else
+                {
+                    const char *home_dir = getenv("HOME");
+                    if (home_dir && home_dir[0])
+                    {
+                        std::string user_plugin_dir (home_dir);
+                        user_plugin_dir += "/.local/share/lldb";
+                        lldb_file_spec.SetFile (user_plugin_dir.c_str(), true);
+                    }
+                }
+
+                if (lldb_file_spec.Exists())
+                    g_lldb_user_plugin_dir.SetCString(lldb_file_spec.GetPath().c_str());
+            }
+            file_spec.GetDirectory() = g_lldb_user_plugin_dir;
+            return file_spec.GetDirectory();
 #endif
-            // TODO: where would user LLDB plug-ins be located on linux? Other systems?
+            // TODO: where would user LLDB plug-ins be located on other systems?
             return false;
         }
     }

Modified: lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp Wed Jul 17 17:17:41 2013
@@ -93,7 +93,7 @@ Symbols::LocateExecutableSymbolFile (con
             if (file_spec.Exists())
             {
                 lldb_private::ModuleSpecList specs;
-                const size_t num_specs = ObjectFile::GetModuleSpecifications (file_spec, 0, specs);
+                const size_t num_specs = ObjectFile::GetModuleSpecifications (file_spec, 0, 0, specs);
                 assert (num_specs <= 1 && "Symbol Vendor supports only a single architecture");
                 if (num_specs == 1)
                 {

Modified: lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp Wed Jul 17 17:17:41 2013
@@ -82,6 +82,13 @@ Host::ThreadCreated (const char *thread_
     }
 }
 
+std::string
+Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid)
+{
+    std::string thread_name;
+    return thread_name;
+}
+
 void
 Host::Backtrace (Stream &strm, uint32_t max_frames)
 {





More information about the llvm-branch-commits mailing list