[llvm-branch-commits] [cfe-branch] r151086 - in /cfe/branches/tooling: ./ bindings/python/clang/ bindings/python/tests/cindex/ examples/clang-interpreter/ examples/wpa/ include/clang/AST/ include/clang/Basic/ include/clang/Frontend/ include/clang/Lex/ include/clang/Parse/ include/clang/Sema/ include/clang/StaticAnalyzer/Core/BugReporter/ include/clang/StaticAnalyzer/Core/PathSensitive/ lib/ARCMigrate/ lib/AST/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Frontend/ lib/Headers/ lib/Lex/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/Seriali...

Manuel Klimek klimek at google.com
Tue Feb 21 13:38:41 PST 2012


Author: klimek
Date: Tue Feb 21 15:38:41 2012
New Revision: 151086

URL: http://llvm.org/viewvc/llvm-project?rev=151086&view=rev
Log:
Merging mainline.

Added:
    cfe/branches/tooling/include/clang/AST/LambdaMangleContext.h
      - copied unchanged from r151084, cfe/trunk/include/clang/AST/LambdaMangleContext.h
    cfe/branches/tooling/lib/AST/LambdaMangleContext.cpp
      - copied unchanged from r151084, cfe/trunk/lib/AST/LambdaMangleContext.cpp
    cfe/branches/tooling/test/Analysis/malloc-interprocedural.c
      - copied unchanged from r151084, cfe/trunk/test/Analysis/malloc-interprocedural.c
    cfe/branches/tooling/test/CodeGen/3dnow-builtins.c
      - copied unchanged from r151084, cfe/trunk/test/CodeGen/3dnow-builtins.c
    cfe/branches/tooling/test/CodeGenCXX/mangle-lambdas.cpp
      - copied unchanged from r151084, cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp
    cfe/branches/tooling/test/CodeGenObjC/ivar-base-as-invariant-load.m
      - copied unchanged from r151084, cfe/trunk/test/CodeGenObjC/ivar-base-as-invariant-load.m
    cfe/branches/tooling/test/CodeGenObjCXX/debug-info.mm
      - copied unchanged from r151084, cfe/trunk/test/CodeGenObjCXX/debug-info.mm
    cfe/branches/tooling/test/Driver/working-directory.c
      - copied unchanged from r151084, cfe/trunk/test/Driver/working-directory.c
    cfe/branches/tooling/test/PCH/cxx-exprs.cpp
      - copied unchanged from r151084, cfe/trunk/test/PCH/cxx-exprs.cpp
    cfe/branches/tooling/test/Rewriter/rewrite-modern-class.mm
      - copied unchanged from r151084, cfe/trunk/test/Rewriter/rewrite-modern-class.mm
    cfe/branches/tooling/test/Rewriter/rewrite-modern-ivars.mm
      - copied unchanged from r151084, cfe/trunk/test/Rewriter/rewrite-modern-ivars.mm
    cfe/branches/tooling/test/Rewriter/rewrite-modern-protocol.mm
      - copied unchanged from r151084, cfe/trunk/test/Rewriter/rewrite-modern-protocol.mm
Modified:
    cfe/branches/tooling/   (props changed)
    cfe/branches/tooling/bindings/python/clang/cindex.py
    cfe/branches/tooling/bindings/python/tests/cindex/test_type.py
    cfe/branches/tooling/examples/clang-interpreter/main.cpp
    cfe/branches/tooling/examples/wpa/clang-wpa.cpp
    cfe/branches/tooling/include/clang/AST/ASTContext.h
    cfe/branches/tooling/include/clang/AST/DeclBase.h
    cfe/branches/tooling/include/clang/AST/DeclCXX.h
    cfe/branches/tooling/include/clang/AST/DeclObjC.h
    cfe/branches/tooling/include/clang/AST/ExprCXX.h
    cfe/branches/tooling/include/clang/AST/Type.h
    cfe/branches/tooling/include/clang/Basic/Diagnostic.h
    cfe/branches/tooling/include/clang/Basic/DiagnosticIDs.h
    cfe/branches/tooling/include/clang/Basic/FileManager.h
    cfe/branches/tooling/include/clang/Basic/LLVM.h
    cfe/branches/tooling/include/clang/Basic/LangOptions.h
    cfe/branches/tooling/include/clang/Basic/SourceLocation.h
    cfe/branches/tooling/include/clang/Basic/SourceManager.h
    cfe/branches/tooling/include/clang/Basic/TargetInfo.h
    cfe/branches/tooling/include/clang/Frontend/ASTUnit.h
    cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h
    cfe/branches/tooling/include/clang/Frontend/CompilerInvocation.h
    cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h
    cfe/branches/tooling/include/clang/Frontend/Utils.h
    cfe/branches/tooling/include/clang/Lex/ModuleMap.h
    cfe/branches/tooling/include/clang/Lex/Preprocessor.h
    cfe/branches/tooling/include/clang/Parse/Parser.h
    cfe/branches/tooling/include/clang/Sema/Sema.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h
    cfe/branches/tooling/lib/ARCMigrate/ARCMT.cpp
    cfe/branches/tooling/lib/AST/ASTContext.cpp
    cfe/branches/tooling/lib/AST/ASTImporter.cpp
    cfe/branches/tooling/lib/AST/CMakeLists.txt
    cfe/branches/tooling/lib/AST/Decl.cpp
    cfe/branches/tooling/lib/AST/DeclBase.cpp
    cfe/branches/tooling/lib/AST/DeclCXX.cpp
    cfe/branches/tooling/lib/AST/DeclObjC.cpp
    cfe/branches/tooling/lib/AST/Expr.cpp
    cfe/branches/tooling/lib/AST/ExprCXX.cpp
    cfe/branches/tooling/lib/AST/ExprConstant.cpp
    cfe/branches/tooling/lib/AST/ItaniumMangle.cpp
    cfe/branches/tooling/lib/Basic/Diagnostic.cpp
    cfe/branches/tooling/lib/Basic/SourceManager.cpp
    cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp
    cfe/branches/tooling/lib/CodeGen/CGClass.cpp
    cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
    cfe/branches/tooling/lib/CodeGen/CGDecl.cpp
    cfe/branches/tooling/lib/CodeGen/CGDeclCXX.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp
    cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h
    cfe/branches/tooling/lib/Driver/Driver.cpp
    cfe/branches/tooling/lib/Frontend/ASTMerge.cpp
    cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
    cfe/branches/tooling/lib/Frontend/ChainedIncludesSource.cpp
    cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp
    cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp
    cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp
    cfe/branches/tooling/lib/Frontend/FrontendAction.cpp
    cfe/branches/tooling/lib/Frontend/Warnings.cpp
    cfe/branches/tooling/lib/Headers/unwind.h
    cfe/branches/tooling/lib/Headers/x86intrin.h
    cfe/branches/tooling/lib/Lex/ModuleMap.cpp
    cfe/branches/tooling/lib/Parse/ParseCXXInlineMethods.cpp
    cfe/branches/tooling/lib/Parse/ParseDecl.cpp
    cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp
    cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp
    cfe/branches/tooling/lib/Parse/ParseStmt.cpp
    cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
    cfe/branches/tooling/lib/Sema/Sema.cpp
    cfe/branches/tooling/lib/Sema/SemaChecking.cpp
    cfe/branches/tooling/lib/Sema/SemaDecl.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/tooling/lib/Sema/SemaExpr.cpp
    cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
    cfe/branches/tooling/lib/Sema/SemaLambda.cpp
    cfe/branches/tooling/lib/Sema/SemaTemplate.cpp
    cfe/branches/tooling/lib/Sema/SemaType.cpp
    cfe/branches/tooling/lib/Sema/TreeTransform.h
    cfe/branches/tooling/lib/Serialization/ASTReader.cpp
    cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp
    cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp
    cfe/branches/tooling/lib/Serialization/ASTWriter.cpp
    cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/Environment.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp
    cfe/branches/tooling/test/Analysis/additive-folding.c
    cfe/branches/tooling/test/Analysis/bstring.c
    cfe/branches/tooling/test/Analysis/cstring-syntax-cxx.cpp
    cfe/branches/tooling/test/Analysis/cstring-syntax.c
    cfe/branches/tooling/test/Analysis/free.c
    cfe/branches/tooling/test/Analysis/keychainAPI.m
    cfe/branches/tooling/test/Analysis/malloc-plist.c
    cfe/branches/tooling/test/Analysis/malloc.c
    cfe/branches/tooling/test/Analysis/malloc.mm
    cfe/branches/tooling/test/Analysis/misc-ps.c
    cfe/branches/tooling/test/Analysis/string.c
    cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp
    cfe/branches/tooling/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
    cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp
    cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
    cfe/branches/tooling/test/CodeGenCXX/debug-info-artificial-arg.cpp
    cfe/branches/tooling/test/CodeGenCXX/debug-info-fwd-ref.cpp
    cfe/branches/tooling/test/CodeGenCXX/init-invariant.cpp
    cfe/branches/tooling/test/CodeGenCXX/lambda-expressions.cpp
    cfe/branches/tooling/test/CodeGenObjC/debug-info-fwddecl.m
    cfe/branches/tooling/test/Driver/gcc-toolchain.cpp
    cfe/branches/tooling/test/Sema/format-strings.c
    cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
    cfe/branches/tooling/test/SemaCXX/for-range-examples.cpp
    cfe/branches/tooling/test/SemaCXX/format-strings.cpp
    cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp
    cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp   (props changed)
    cfe/branches/tooling/test/SemaObjC/format-strings-objc.m
    cfe/branches/tooling/tools/arcmt-test/arcmt-test.cpp
    cfe/branches/tooling/tools/driver/cc1_main.cpp
    cfe/branches/tooling/tools/driver/cc1as_main.cpp
    cfe/branches/tooling/tools/driver/driver.cpp
    cfe/branches/tooling/tools/libclang/CIndex.cpp
    cfe/branches/tooling/tools/libclang/CIndexCodeCompletion.cpp
    cfe/branches/tooling/tools/libclang/Indexing.cpp
    cfe/branches/tooling/tools/libclang/IndexingContext.h
    cfe/branches/tooling/unittests/Basic/SourceManagerTest.cpp
    cfe/branches/tooling/unittests/Lex/LexerTest.cpp
    cfe/branches/tooling/utils/analyzer/SATestBuild.py

Propchange: cfe/branches/tooling/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 21 15:38:41 2012
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-150926
+/cfe/trunk:146581-151084
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/tooling/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/bindings/python/clang/cindex.py?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/bindings/python/clang/cindex.py (original)
+++ cfe/branches/tooling/bindings/python/clang/cindex.py Tue Feb 21 15:38:41 2012
@@ -63,6 +63,7 @@
 # o implement additional SourceLocation, SourceRange, and File methods.
 
 from ctypes import *
+import collections
 
 def get_cindex_library():
     # FIXME: It's probably not the case that the library is actually found in
@@ -1137,6 +1138,44 @@
         """Return the kind of this type."""
         return TypeKind.from_id(self._kind_id)
 
+    def argument_types(self):
+        """Retrieve a container for the non-variadic arguments for this type.
+
+        The returned object is iterable and indexable. Each item in the
+        container is a Type instance.
+        """
+        class ArgumentsIterator(collections.Sequence):
+            def __init__(self, parent):
+                self.parent = parent
+                self.length = None
+
+            def __len__(self):
+                if self.length is None:
+                    self.length = Type_get_num_arg_types(self.parent)
+
+                return self.length
+
+            def __getitem__(self, key):
+                # FIXME Support slice objects.
+                if not isinstance(key, int):
+                    raise TypeError("Must supply a non-negative int.")
+
+                if key < 0:
+                    raise IndexError("Only non-negative indexes are accepted.")
+
+                if key >= len(self):
+                    raise IndexError("Index greater than container length: "
+                                     "%d > %d" % ( key, len(self) ))
+
+                result = Type_get_arg_type(self.parent, key)
+                if result.kind == TypeKind.INVALID:
+                    raise IndexError("Argument could not be retrieved.")
+
+                return result
+
+        assert self.kind == TypeKind.FUNCTIONPROTO
+        return ArgumentsIterator(self)
+
     @property
     def element_type(self):
         """Retrieve the Type of elements within this Type.
@@ -1182,29 +1221,35 @@
         return Type_get_canonical(self)
 
     def is_const_qualified(self):
-        """
-        Determine whether a Type has the "const" qualifier set,
-        without looking through typedefs that may have added "const"
+        """Determine whether a Type has the "const" qualifier set.
+
+        This does not look through typedefs that may have added "const"
         at a different level.
         """
         return Type_is_const_qualified(self)
 
     def is_volatile_qualified(self):
-        """
-        Determine whether a Type has the "volatile" qualifier set,
-        without looking through typedefs that may have added
-        "volatile" at a different level.
+        """Determine whether a Type has the "volatile" qualifier set.
+
+        This does not look through typedefs that may have added "volatile"
+        at a different level.
         """
         return Type_is_volatile_qualified(self)
 
     def is_restrict_qualified(self):
-        """
-        Determine whether a Type has the "restrict" qualifier set,
-        without looking through typedefs that may have added
-        "restrict" at a different level.
+        """Determine whether a Type has the "restrict" qualifier set.
+
+        This does not look through typedefs that may have added "restrict" at
+        a different level.
         """
         return Type_is_restrict_qualified(self)
 
+    def is_function_variadic(self):
+        """Determine whether this function Type is a variadic function type."""
+        assert self.kind == TypeKind.FUNCTIONPROTO
+
+        return Type_is_variadic(self)
+
     def is_pod(self):
         """Determine whether this Type represents plain old data (POD)."""
         return Type_is_pod(self)
@@ -1239,6 +1284,15 @@
         """
         return Type_get_array_size(self)
 
+    def __eq__(self, other):
+        if type(other) != type(self):
+            return False
+
+        return Type_equal(self, other)
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
 ## CIndex Objects ##
 
 # CIndex objects (derived from ClangObject) are essentially lightweight
@@ -1893,6 +1947,10 @@
 Type_is_pod.argtypes = [Type]
 Type_is_pod.restype = bool
 
+Type_is_variadic = lib.clang_isFunctionTypeVariadic
+Type_is_variadic.argtypes = [Type]
+Type_is_variadic.restype = bool
+
 Type_get_pointee = lib.clang_getPointeeType
 Type_get_pointee.argtypes = [Type]
 Type_get_pointee.restype = Type
@@ -1908,7 +1966,16 @@
 Type_get_result.restype = Type
 Type_get_result.errcheck = Type.from_result
 
+Type_get_num_arg_types = lib.clang_getNumArgTypes
+Type_get_num_arg_types.argtypes = [Type]
+Type_get_num_arg_types.restype = c_uint
+
+Type_get_arg_type = lib.clang_getArgType
+Type_get_arg_type.argtypes = [Type, c_uint]
+Type_get_arg_type.restype = Type
+Type_get_arg_type.errcheck = Type.from_result
 Type_get_element_type = lib.clang_getElementType
+
 Type_get_element_type.argtypes = [Type]
 Type_get_element_type.restype = Type
 Type_get_element_type.errcheck = Type.from_result
@@ -1926,6 +1993,10 @@
 Type_get_array_size.argtype = [Type]
 Type_get_array_size.restype = c_longlong
 
+Type_equal = lib.clang_equalTypes
+Type_equal.argtypes = [Type, Type]
+Type_equal.restype = bool
+
 # Index Functions
 Index_create = lib.clang_createIndex
 Index_create.argtypes = [c_int, c_int]

Modified: cfe/branches/tooling/bindings/python/tests/cindex/test_type.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/bindings/python/tests/cindex/test_type.py?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/bindings/python/tests/cindex/test_type.py (original)
+++ cfe/branches/tooling/bindings/python/tests/cindex/test_type.py Tue Feb 21 15:38:41 2012
@@ -1,7 +1,7 @@
+from clang.cindex import Cursor
 from clang.cindex import CursorKind
 from clang.cindex import Index
 from clang.cindex import TypeKind
-from nose.tools import ok_
 from nose.tools import raises
 
 kInput = """\
@@ -21,64 +21,85 @@
 
 """
 
-def test_a_struct():
+def get_tu(source=kInput, lang='c'):
+    name = 't.c'
+    if lang == 'cpp':
+        name = 't.cpp'
+
     index = Index.create()
-    tu = index.parse('t.c', unsaved_files = [('t.c',kInput)])
+    tu = index.parse(name, unsaved_files=[(name, source)])
+    assert tu is not None
+    return tu
 
-    for n in tu.cursor.get_children():
-        if n.spelling == 'teststruct':
-            fields = list(n.get_children())
-
-            assert all(x.kind == CursorKind.FIELD_DECL for x in fields)
-
-            assert fields[0].spelling == 'a'
-            assert not fields[0].type.is_const_qualified()
-            assert fields[0].type.kind == TypeKind.INT
-            assert fields[0].type.get_canonical().kind == TypeKind.INT
-
-            assert fields[1].spelling == 'b'
-            assert not fields[1].type.is_const_qualified()
-            assert fields[1].type.kind == TypeKind.TYPEDEF
-            assert fields[1].type.get_canonical().kind == TypeKind.INT
-            assert fields[1].type.get_declaration().spelling == 'I'
-
-            assert fields[2].spelling == 'c'
-            assert not fields[2].type.is_const_qualified()
-            assert fields[2].type.kind == TypeKind.LONG
-            assert fields[2].type.get_canonical().kind == TypeKind.LONG
-
-            assert fields[3].spelling == 'd'
-            assert not fields[3].type.is_const_qualified()
-            assert fields[3].type.kind == TypeKind.ULONG
-            assert fields[3].type.get_canonical().kind == TypeKind.ULONG
-
-            assert fields[4].spelling == 'e'
-            assert not fields[4].type.is_const_qualified()
-            assert fields[4].type.kind == TypeKind.LONG
-            assert fields[4].type.get_canonical().kind == TypeKind.LONG
-
-            assert fields[5].spelling == 'f'
-            assert fields[5].type.is_const_qualified()
-            assert fields[5].type.kind == TypeKind.INT
-            assert fields[5].type.get_canonical().kind == TypeKind.INT
-
-            assert fields[6].spelling == 'g'
-            assert not fields[6].type.is_const_qualified()
-            assert fields[6].type.kind == TypeKind.POINTER
-            assert fields[6].type.get_pointee().kind == TypeKind.INT
-
-            assert fields[7].spelling == 'h'
-            assert not fields[7].type.is_const_qualified()
-            assert fields[7].type.kind == TypeKind.POINTER
-            assert fields[7].type.get_pointee().kind == TypeKind.POINTER
-            assert fields[7].type.get_pointee().get_pointee().kind == TypeKind.POINTER
-            assert fields[7].type.get_pointee().get_pointee().get_pointee().kind == TypeKind.INT
+def get_cursor(source, spelling):
+    children = []
+    if isinstance(source, Cursor):
+        children = source.get_children()
+    else:
+        # Assume TU
+        children = source.cursor.get_children()
 
-            break
+    for cursor in children:
+        if cursor.spelling == spelling:
+            return cursor
+
+        # Recurse into children.
+        result = get_cursor(cursor, spelling)
+        if result is not None:
+            return result
 
-    else:
-        assert False, "Didn't find teststruct??"
+    return None
+
+def test_a_struct():
+    tu = get_tu(kInput)
 
+    teststruct = get_cursor(tu, 'teststruct')
+    assert teststruct is not None, "Could not find teststruct."
+    fields = list(teststruct.get_children())
+    assert all(x.kind == CursorKind.FIELD_DECL for x in fields)
+
+    assert fields[0].spelling == 'a'
+    assert not fields[0].type.is_const_qualified()
+    assert fields[0].type.kind == TypeKind.INT
+    assert fields[0].type.get_canonical().kind == TypeKind.INT
+
+    assert fields[1].spelling == 'b'
+    assert not fields[1].type.is_const_qualified()
+    assert fields[1].type.kind == TypeKind.TYPEDEF
+    assert fields[1].type.get_canonical().kind == TypeKind.INT
+    assert fields[1].type.get_declaration().spelling == 'I'
+
+    assert fields[2].spelling == 'c'
+    assert not fields[2].type.is_const_qualified()
+    assert fields[2].type.kind == TypeKind.LONG
+    assert fields[2].type.get_canonical().kind == TypeKind.LONG
+
+    assert fields[3].spelling == 'd'
+    assert not fields[3].type.is_const_qualified()
+    assert fields[3].type.kind == TypeKind.ULONG
+    assert fields[3].type.get_canonical().kind == TypeKind.ULONG
+
+    assert fields[4].spelling == 'e'
+    assert not fields[4].type.is_const_qualified()
+    assert fields[4].type.kind == TypeKind.LONG
+    assert fields[4].type.get_canonical().kind == TypeKind.LONG
+
+    assert fields[5].spelling == 'f'
+    assert fields[5].type.is_const_qualified()
+    assert fields[5].type.kind == TypeKind.INT
+    assert fields[5].type.get_canonical().kind == TypeKind.INT
+
+    assert fields[6].spelling == 'g'
+    assert not fields[6].type.is_const_qualified()
+    assert fields[6].type.kind == TypeKind.POINTER
+    assert fields[6].type.get_pointee().kind == TypeKind.INT
+
+    assert fields[7].spelling == 'h'
+    assert not fields[7].type.is_const_qualified()
+    assert fields[7].type.kind == TypeKind.POINTER
+    assert fields[7].type.get_pointee().kind == TypeKind.POINTER
+    assert fields[7].type.get_pointee().get_pointee().kind == TypeKind.POINTER
+    assert fields[7].type.get_pointee().get_pointee().get_pointee().kind == TypeKind.INT
 
 constarrayInput="""
 struct teststruct {
@@ -86,33 +107,103 @@
 };
 """
 def testConstantArray():
-    index = Index.create()
-    tu = index.parse('t.c', unsaved_files = [('t.c',constarrayInput)])
+    tu = get_tu(constarrayInput)
 
-    for n in tu.cursor.get_children():
-        if n.spelling == 'teststruct':
-            fields = list(n.get_children())
-            assert fields[0].spelling == 'A'
-            assert fields[0].type.kind == TypeKind.CONSTANTARRAY
-            assert fields[0].type.get_array_element_type() is not None
-            assert fields[0].type.get_array_element_type().kind == TypeKind.POINTER
-            assert fields[0].type.get_array_size() == 2
+    teststruct = get_cursor(tu, 'teststruct')
+    assert teststruct is not None, "Didn't find teststruct??"
+    fields = list(teststruct.get_children())
+    assert fields[0].spelling == 'A'
+    assert fields[0].type.kind == TypeKind.CONSTANTARRAY
+    assert fields[0].type.get_array_element_type() is not None
+    assert fields[0].type.get_array_element_type().kind == TypeKind.POINTER
+    assert fields[0].type.get_array_size() == 2
+
+def test_equal():
+    """Ensure equivalence operators work on Type."""
+    source = 'int a; int b; void *v;'
+    tu = get_tu(source)
+
+    a = get_cursor(tu, 'a')
+    b = get_cursor(tu, 'b')
+    v = get_cursor(tu, 'v')
+
+    assert a is not None
+    assert b is not None
+    assert v is not None
+
+    assert a.type == b.type
+    assert a.type != v.type
+
+    assert a.type != None
+    assert a.type != 'foo'
+
+def test_function_argument_types():
+    """Ensure that Type.argument_types() works as expected."""
+    tu = get_tu('void f(int, int);')
+    f = get_cursor(tu, 'f')
+    assert f is not None
 
-            break
-    else:
-        assert False, "Didn't find teststruct??"
+    args = f.type.argument_types()
+    assert args is not None
+    assert len(args) == 2
+
+    t0 = args[0]
+    assert t0 is not None
+    assert t0.kind == TypeKind.INT
+
+    t1 = args[1]
+    assert t1 is not None
+    assert t1.kind == TypeKind.INT
+
+    args2 = list(args)
+    assert len(args2) == 2
+    assert t0 == args2[0]
+    assert t1 == args2[1]
+
+ at raises(TypeError)
+def test_argument_types_string_key():
+    """Ensure that non-int keys raise a TypeError."""
+    tu = get_tu('void f(int, int);')
+    f = get_cursor(tu, 'f')
+    assert f is not None
 
-def test_is_pod():
-    index = Index.create()
-    tu = index.parse('t.c', unsaved_files=[('t.c', 'int i; void f();')])
-    assert tu is not None
-    i, f = None, None
+    args = f.type.argument_types()
+    assert len(args) == 2
+
+    args['foo']
 
-    for cursor in tu.cursor.get_children():
-        if cursor.spelling == 'i':
-            i = cursor
-        elif cursor.spelling == 'f':
-            f = cursor
+ at raises(IndexError)
+def test_argument_types_negative_index():
+    """Ensure that negative indexes on argument_types Raises an IndexError."""
+    tu = get_tu('void f(int, int);')
+    f = get_cursor(tu, 'f')
+    args = f.type.argument_types()
+
+    args[-1]
+
+ at raises(IndexError)
+def test_argument_types_overflow_index():
+    """Ensure that indexes beyond the length of Type.argument_types() raise."""
+    tu = get_tu('void f(int, int);')
+    f = get_cursor(tu, 'f')
+    args = f.type.argument_types()
+
+    args[2]
+
+ at raises(Exception)
+def test_argument_types_invalid_type():
+    """Ensure that obtaining argument_types on a Type without them raises."""
+    tu = get_tu('int i;')
+    i = get_cursor(tu, 'i')
+    assert i is not None
+
+    i.type.argument_types()
+
+def test_is_pod():
+    """Ensure Type.is_pod() works."""
+    tu = get_tu('int i; void f();')
+    i = get_cursor(tu, 'i')
+    f = get_cursor(tu, 'f')
 
     assert i is not None
     assert f is not None
@@ -120,15 +211,32 @@
     assert i.type.is_pod()
     assert not f.type.is_pod()
 
-def test_element_type():
-    index = Index.create()
-    tu = index.parse('t.c', unsaved_files=[('t.c', 'int i[5];')])
-    assert tu is not None
+def test_function_variadic():
+    """Ensure Type.is_function_variadic works."""
+
+    source ="""
+#include <stdarg.h>
 
-    for cursor in tu.cursor.get_children():
-        if cursor.spelling == 'i':
-            i = cursor
-            break
+void foo(int a, ...);
+void bar(int a, int b);
+"""
+
+    tu = get_tu(source)
+    foo = get_cursor(tu, 'foo')
+    bar = get_cursor(tu, 'bar')
+
+    assert foo is not None
+    assert bar is not None
+
+    assert isinstance(foo.type.is_function_variadic(), bool)
+    assert foo.type.is_function_variadic()
+    assert not bar.type.is_function_variadic()
+
+def test_element_type():
+    """Ensure Type.element_type works."""
+    tu = get_tu('int i[5];')
+    i = get_cursor(tu, 'i')
+    assert i is not None
 
     assert i.type.kind == TypeKind.CONSTANTARRAY
     assert i.type.element_type.kind == TypeKind.INT
@@ -136,28 +244,16 @@
 @raises(Exception)
 def test_invalid_element_type():
     """Ensure Type.element_type raises if type doesn't have elements."""
-    index = Index.create()
-    tu = index.parse('t.c', unsaved_files=[('t.c', 'int i;')])
-
-    i = None
-    for cursor in tu.cursor.get_children():
-        if cursor.spelling == 'i':
-            i = cursor
-            break
-
-    ok_(i is not None)
+    tu = get_tu('int i;')
+    i = get_cursor(tu, 'i')
+    assert i is not None
     i.element_type
 
 def test_element_count():
-    index = Index.create()
-    tu = index.parse('t.c', unsaved_files=[('t.c', 'int i[5]; int j;')])
-    assert tu is not None
-
-    for cursor in tu.cursor.get_children():
-        if cursor.spelling == 'i':
-            i = cursor
-        elif cursor.spelling == 'j':
-            j = cursor
+    """Ensure Type.element_count works."""
+    tu = get_tu('int i[5]; int j;')
+    i = get_cursor(tu, 'i')
+    j = get_cursor(tu, 'j')
 
     assert i is not None
     assert j is not None
@@ -169,3 +265,33 @@
         assert False
     except:
         assert True
+
+def test_is_volatile_qualified():
+    """Ensure Type.is_volatile_qualified works."""
+
+    tu = get_tu('volatile int i = 4; int j = 2;')
+
+    i = get_cursor(tu, 'i')
+    j = get_cursor(tu, 'j')
+
+    assert i is not None
+    assert j is not None
+
+    assert isinstance(i.type.is_volatile_qualified(), bool)
+    assert i.type.is_volatile_qualified()
+    assert not j.type.is_volatile_qualified()
+
+def test_is_restrict_qualified():
+    """Ensure Type.is_restrict_qualified works."""
+
+    tu = get_tu('struct s { void * restrict i; void * j };')
+
+    i = get_cursor(tu, 'i')
+    j = get_cursor(tu, 'j')
+
+    assert i is not None
+    assert j is not None
+
+    assert isinstance(i.type.is_restrict_qualified(), bool)
+    assert i.type.is_restrict_qualified()
+    assert not j.type.is_restrict_qualified()

Modified: cfe/branches/tooling/examples/clang-interpreter/main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/examples/clang-interpreter/main.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/examples/clang-interpreter/main.cpp (original)
+++ cfe/branches/tooling/examples/clang-interpreter/main.cpp Tue Feb 21 15:38:41 2012
@@ -72,7 +72,7 @@
   TextDiagnosticPrinter *DiagClient =
     new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
 
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
   DiagnosticsEngine Diags(DiagID, DiagClient);
   Driver TheDriver(Path.str(), llvm::sys::getDefaultTargetTriple(),
                    "a.out", /*IsProduction=*/false, Diags);

Modified: cfe/branches/tooling/examples/wpa/clang-wpa.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/examples/wpa/clang-wpa.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/examples/wpa/clang-wpa.cpp (original)
+++ cfe/branches/tooling/examples/wpa/clang-wpa.cpp Tue Feb 21 15:38:41 2012
@@ -90,7 +90,7 @@
     return 0;
 
   DiagnosticOptions DiagOpts;
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags
+  IntrusiveRefCntPtr<Diagnostic> Diags
     = CompilerInstance::createDiagnostics(DiagOpts, argc, argv);
   for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
     const std::string &InFile = InputFilenames[i];

Modified: cfe/branches/tooling/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/ASTContext.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/ASTContext.h (original)
+++ cfe/branches/tooling/include/clang/AST/ASTContext.h Tue Feb 21 15:38:41 2012
@@ -21,6 +21,7 @@
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/VersionTuple.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/LambdaMangleContext.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/TemplateName.h"
@@ -81,7 +82,7 @@
 
 /// ASTContext - This class holds long-lived AST nodes (such as types and
 /// decls) that can be referred to throughout the semantic analysis of a file.
-class ASTContext : public llvm::RefCountedBase<ASTContext> {
+class ASTContext : public RefCountedBase<ASTContext> {
   ASTContext &this_() { return *this; }
 
   mutable std::vector<Type*> Types;
@@ -328,6 +329,10 @@
   
   friend class CXXConversionDecl;
   
+  /// \brief Mapping from each declaration context to its corresponding lambda 
+  /// mangling context.
+  llvm::DenseMap<const DeclContext *, LambdaMangleContext> LambdaMangleContexts;
+  
   /// \brief Mapping that stores parameterIndex values for ParmVarDecls
   /// when that value exceeds the bitfield size of
   /// ParmVarDeclBits.ParameterIndex.
@@ -1765,6 +1770,8 @@
   /// it is not used.
   bool DeclMustBeEmitted(const Decl *D);
 
+  /// \brief Retrieve the lambda mangling number for a lambda expression.
+  unsigned getLambdaManglingNumber(CXXMethodDecl *CallOperator);
   
   /// \brief Used by ParmVarDecl to store on the side the
   /// index of the parameter when it exceeds the size of the normal bitfield.

Modified: cfe/branches/tooling/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclBase.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclBase.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclBase.h Tue Feb 21 15:38:41 2012
@@ -848,8 +848,8 @@
   static void printGroup(Decl** Begin, unsigned NumDecls,
                          raw_ostream &Out, const PrintingPolicy &Policy,
                          unsigned Indentation = 0);
-  void dump() const;
-  void dumpXML() const;
+  LLVM_ATTRIBUTE_USED void dump() const;
+  LLVM_ATTRIBUTE_USED void dumpXML() const;
   void dumpXML(raw_ostream &OS) const;
 
 private:
@@ -1490,7 +1490,7 @@
   static bool classof(const NAME##Decl *D) { return true; }
 #include "clang/AST/DeclNodes.inc"
 
-  void dumpDeclContext() const;
+  LLVM_ATTRIBUTE_USED void dumpDeclContext() const;
 
 private:
   void LoadLexicalDeclsFromExternalStorage() const;

Modified: cfe/branches/tooling/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclCXX.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclCXX.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclCXX.h Tue Feb 21 15:38:41 2012
@@ -560,20 +560,41 @@
   struct LambdaDefinitionData : public DefinitionData {
     typedef LambdaExpr::Capture Capture;
     
-    LambdaDefinitionData(CXXRecordDecl *D) 
-      : DefinitionData(D), NumCaptures(0), NumExplicitCaptures(0), Captures(0) { 
+    LambdaDefinitionData(CXXRecordDecl *D, bool Dependent) 
+      : DefinitionData(D), Dependent(Dependent), NumCaptures(0), 
+        NumExplicitCaptures(0), ManglingNumber(0), ContextDecl(0), Captures(0) 
+    {
       IsLambda = true;
     }
 
+    /// \brief Whether this lambda is known to be dependent, even if its
+    /// context isn't dependent.
+    /// 
+    /// A lambda with a non-dependent context can be dependent if it occurs
+    /// within the default argument of a function template, because the
+    /// lambda will have been created with the enclosing context as its
+    /// declaration context, rather than function. This is an unfortunate
+    /// artifact of having to parse the default arguments before 
+    unsigned Dependent : 1;
+    
     /// \brief The number of captures in this lambda.
     unsigned NumCaptures : 16;
 
     /// \brief The number of explicit captures in this lambda.
     unsigned NumExplicitCaptures : 15;
 
-    /// \brief The "extra" data associated with the lambda, including
-    /// captures, capture initializers, the body of the lambda, and the
-    /// array-index variables for array captures.
+    /// \brief The number used to indicate this lambda expression for name 
+    /// mangling in the Itanium C++ ABI.
+    unsigned ManglingNumber;
+    
+    /// \brief The declaration that provides context for this lambda, if the
+    /// actual DeclContext does not suffice. This is used for lambdas that
+    /// occur within default arguments of function parameters within the class
+    /// or within a data member initializer.
+    Decl *ContextDecl;
+    
+    /// \brief The list of captures, both explicit and implicit, for this 
+    /// lambda.
     Capture *Captures;    
   };
 
@@ -678,7 +699,7 @@
                                IdentifierInfo *Id, CXXRecordDecl* PrevDecl=0,
                                bool DelayTypeCreation = false);
   static CXXRecordDecl *CreateLambda(const ASTContext &C, DeclContext *DC,
-                                     SourceLocation Loc);
+                                     SourceLocation Loc, bool DependentLambda);
   static CXXRecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID);
 
   bool isDynamicClass() const {
@@ -1442,6 +1463,46 @@
   /// actually abstract.
   bool mayBeAbstract() const;
 
+  /// \brief If this is the closure type of a lambda expression, retrieve the
+  /// number to be used for name mangling in the Itanium C++ ABI.
+  ///
+  /// Zero indicates that this closure type has internal linkage, so the 
+  /// mangling number does not matter, while a non-zero value indicates which
+  /// lambda expression this is in this particular context.
+  unsigned getLambdaManglingNumber() const {
+    assert(isLambda() && "Not a lambda closure type!");
+    return getLambdaData().ManglingNumber;
+  }
+  
+  /// \brief Retrieve the declaration that provides additional context for a 
+  /// lambda, when the normal declaration context is not specific enough.
+  ///
+  /// Certain contexts (default arguments of in-class function parameters and 
+  /// the initializers of data members) have separate name mangling rules for
+  /// lambdas within the Itanium C++ ABI. For these cases, this routine provides
+  /// the declaration in which the lambda occurs, e.g., the function parameter 
+  /// or the non-static data member. Otherwise, it returns NULL to imply that
+  /// the declaration context suffices.
+  Decl *getLambdaContextDecl() const {
+    assert(isLambda() && "Not a lambda closure type!");
+    return getLambdaData().ContextDecl;    
+  }
+  
+  /// \brief Determine whether this lambda expression was known to be dependent
+  /// at the time it was created, even if its context does not appear to be
+  /// dependent.
+  ///
+  /// This flag is a workaround for an issue with parsing, where default
+  /// arguments are parsed before their enclosing function declarations have
+  /// been created. This means that any lambda expressions within those
+  /// default arguments will have as their DeclContext the context enclosing
+  /// the function declaration, which may be non-dependent even when the
+  /// function declaration itself is dependent. This flag indicates when we
+  /// know that the lambda is dependent despite that.
+  bool isDependentLambda() const {
+    return isLambda() && getLambdaData().Dependent;
+  }
+  
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) {
     return K >= firstCXXRecord && K <= lastCXXRecord;

Modified: cfe/branches/tooling/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclObjC.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclObjC.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclObjC.h Tue Feb 21 15:38:41 2012
@@ -1283,12 +1283,19 @@
   /// \brief The location of the category name in this declaration.
   SourceLocation CategoryNameLoc;
 
+  /// class extension may have private ivars.
+  SourceLocation IvarLBraceLoc;
+  SourceLocation IvarRBraceLoc;
+  
   ObjCCategoryDecl(DeclContext *DC, SourceLocation AtLoc,
                    SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc,
-                   IdentifierInfo *Id, ObjCInterfaceDecl *IDecl)
+                   IdentifierInfo *Id, ObjCInterfaceDecl *IDecl,
+                   SourceLocation IvarLBraceLoc=SourceLocation(),
+                   SourceLocation IvarRBraceLoc=SourceLocation())
     : ObjCContainerDecl(ObjCCategory, DC, Id, ClassNameLoc, AtLoc),
       ClassInterface(IDecl), NextClassCategory(0), HasSynthBitfield(false),
-      CategoryNameLoc(CategoryNameLoc) {
+      CategoryNameLoc(CategoryNameLoc),
+      IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc) {
   }
 public:
 
@@ -1297,7 +1304,9 @@
                                   SourceLocation ClassNameLoc,
                                   SourceLocation CategoryNameLoc,
                                   IdentifierInfo *Id,
-                                  ObjCInterfaceDecl *IDecl);
+                                  ObjCInterfaceDecl *IDecl,
+                                  SourceLocation IvarLBraceLoc=SourceLocation(),
+                                  SourceLocation IvarRBraceLoc=SourceLocation());
   static ObjCCategoryDecl *CreateDeserialized(ASTContext &C, unsigned ID);
 
   ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
@@ -1353,6 +1362,11 @@
 
   SourceLocation getCategoryNameLoc() const { return CategoryNameLoc; }
   void setCategoryNameLoc(SourceLocation Loc) { CategoryNameLoc = Loc; }
+  
+  void setIvarLBraceLoc(SourceLocation Loc) { IvarLBraceLoc = Loc; }
+  SourceLocation getIvarLBraceLoc() const { return IvarLBraceLoc; }
+  void setIvarRBraceLoc(SourceLocation Loc) { IvarRBraceLoc = Loc; }
+  SourceLocation getIvarRBraceLoc() const { return IvarRBraceLoc; }
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const ObjCCategoryDecl *D) { return true; }
@@ -1521,6 +1535,10 @@
   virtual void anchor();
   /// Implementation Class's super class.
   ObjCInterfaceDecl *SuperClass;
+  /// @implementation may have private ivars.
+  SourceLocation IvarLBraceLoc;
+  SourceLocation IvarRBraceLoc;
+  
   /// Support for ivar initialization.
   /// IvarInitializers - The arguments used to initialize the ivars
   CXXCtorInitializer **IvarInitializers;
@@ -1535,16 +1553,22 @@
   ObjCImplementationDecl(DeclContext *DC,
                          ObjCInterfaceDecl *classInterface,
                          ObjCInterfaceDecl *superDecl,
-                         SourceLocation nameLoc, SourceLocation atStartLoc)
+                         SourceLocation nameLoc, SourceLocation atStartLoc,
+                         SourceLocation IvarLBraceLoc=SourceLocation(), 
+                         SourceLocation IvarRBraceLoc=SourceLocation())
     : ObjCImplDecl(ObjCImplementation, DC, classInterface, nameLoc, atStartLoc),
-       SuperClass(superDecl), IvarInitializers(0), NumIvarInitializers(0),
-       HasCXXStructors(false), HasSynthBitfield(false) {}
+       SuperClass(superDecl), IvarLBraceLoc(IvarLBraceLoc), 
+       IvarRBraceLoc(IvarRBraceLoc),
+       IvarInitializers(0), NumIvarInitializers(0),
+       HasCXXStructors(false), HasSynthBitfield(false){}
 public:
   static ObjCImplementationDecl *Create(ASTContext &C, DeclContext *DC,
                                         ObjCInterfaceDecl *classInterface,
                                         ObjCInterfaceDecl *superDecl,
                                         SourceLocation nameLoc,
-                                        SourceLocation atStartLoc);
+                                        SourceLocation atStartLoc,
+                                        SourceLocation IvarLBraceLoc=SourceLocation(), 
+                                        SourceLocation IvarRBraceLoc=SourceLocation());
 
   static ObjCImplementationDecl *CreateDeserialized(ASTContext &C, unsigned ID);
 
@@ -1623,6 +1647,11 @@
 
   void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; }
 
+  void setIvarLBraceLoc(SourceLocation Loc) { IvarLBraceLoc = Loc; }
+  SourceLocation getIvarLBraceLoc() const { return IvarLBraceLoc; }
+  void setIvarRBraceLoc(SourceLocation Loc) { IvarRBraceLoc = Loc; }
+  SourceLocation getIvarRBraceLoc() const { return IvarRBraceLoc; }
+  
   typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
   ivar_iterator ivar_begin() const {
     return ivar_iterator(decls_begin());

Modified: cfe/branches/tooling/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/ExprCXX.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/ExprCXX.h (original)
+++ cfe/branches/tooling/include/clang/AST/ExprCXX.h Tue Feb 21 15:38:41 2012
@@ -1166,7 +1166,9 @@
              ArrayRef<Expr *> CaptureInits,
              ArrayRef<VarDecl *> ArrayIndexVars,
              ArrayRef<unsigned> ArrayIndexStarts,
-             SourceLocation ClosingBrace);
+             SourceLocation ClosingBrace,
+             unsigned ManglingNumber,
+             Decl *ContextDecl);
 
   /// \brief Construct an empty lambda expression.
   LambdaExpr(EmptyShell Empty, unsigned NumCaptures, bool HasArrayIndexVars)
@@ -1204,7 +1206,9 @@
                             ArrayRef<Expr *> CaptureInits,
                             ArrayRef<VarDecl *> ArrayIndexVars,
                             ArrayRef<unsigned> ArrayIndexStarts,
-                            SourceLocation ClosingBrace);
+                            SourceLocation ClosingBrace,
+                            unsigned ManglingNumber,
+                            Decl *ContextDecl);
 
   /// \brief Construct a new lambda expression that will be deserialized from
   /// an external source.
@@ -1296,7 +1300,7 @@
 
   /// \brief Whether this lambda had its result type explicitly specified.
   bool hasExplicitResultType() const { return ExplicitResultType; }
-  
+    
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == LambdaExprClass;
   }

Modified: cfe/branches/tooling/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Type.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Type.h (original)
+++ cfe/branches/tooling/include/clang/AST/Type.h Tue Feb 21 15:38:41 2012
@@ -1706,7 +1706,7 @@
     return CanonicalType;
   }
   CanQualType getCanonicalTypeUnqualified() const; // in CanonicalType.h
-  void dump() const;
+  LLVM_ATTRIBUTE_USED void dump() const;
 
   static bool classof(const Type *) { return true; }
 

Modified: cfe/branches/tooling/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/Diagnostic.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/Diagnostic.h (original)
+++ cfe/branches/tooling/include/clang/Basic/Diagnostic.h Tue Feb 21 15:38:41 2012
@@ -105,7 +105,7 @@
 /// "report warnings as errors" and passes them off to the DiagnosticConsumer
 /// for reporting to the user. DiagnosticsEngine is tied to one translation unit
 /// and one SourceManager.
-class DiagnosticsEngine : public llvm::RefCountedBase<DiagnosticsEngine> {
+class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
 public:
   /// Level - The level of the diagnostic, after it has been through mapping.
   enum Level {
@@ -161,7 +161,7 @@
   unsigned ConstexprBacktraceLimit; // Cap on depth of constexpr evaluation
                                     // backtrace stack, 0 -> no limit.
   ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors?
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> Diags;
+  IntrusiveRefCntPtr<DiagnosticIDs> Diags;
   DiagnosticConsumer *Client;
   bool OwnsDiagClient;
   SourceManager *SourceMgr;
@@ -306,12 +306,12 @@
 
 public:
   explicit DiagnosticsEngine(
-                      const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags,
+                      const IntrusiveRefCntPtr<DiagnosticIDs> &Diags,
                       DiagnosticConsumer *client = 0,
                       bool ShouldOwnClient = true);
   ~DiagnosticsEngine();
 
-  const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const {
+  const IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const {
     return Diags;
   }
 

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticIDs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticIDs.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticIDs.h (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticIDs.h Tue Feb 21 15:38:41 2012
@@ -109,7 +109,7 @@
 
 /// \brief Used for handling and querying diagnostic IDs. Can be used and shared
 /// by multiple Diagnostics for multiple translation units.
-class DiagnosticIDs : public llvm::RefCountedBase<DiagnosticIDs> {
+class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
 public:
   /// Level - The level of the diagnostic, after it has been through mapping.
   enum Level {

Modified: cfe/branches/tooling/include/clang/Basic/FileManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/FileManager.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/FileManager.h (original)
+++ cfe/branches/tooling/include/clang/Basic/FileManager.h Tue Feb 21 15:38:41 2012
@@ -110,7 +110,7 @@
 /// properties, such as uniquing files based on "inode", so that a file with two
 /// names (e.g. symlinked) will be treated as a single file.
 ///
-class FileManager : public llvm::RefCountedBase<FileManager> {
+class FileManager : public RefCountedBase<FileManager> {
   FileSystemOptions FileSystemOpts;
 
   class UniqueDirContainer;

Modified: cfe/branches/tooling/include/clang/Basic/LLVM.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/LLVM.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/LLVM.h (original)
+++ cfe/branches/tooling/include/clang/Basic/LLVM.h Tue Feb 21 15:38:41 2012
@@ -29,6 +29,12 @@
   template<typename T, unsigned N> class SmallVector;
   template<typename T> class SmallVectorImpl;
 
+  // Reference counting.
+  template <typename T> class IntrusiveRefCntPtr;
+  template <typename T> struct IntrusiveRefCntPtrInfo;
+  template <class Derived> class RefCountedBase;
+  class RefCountedBaseVPTR;
+
   class raw_ostream;
   // TODO: DenseMap, ...
 }
@@ -50,7 +56,13 @@
   using llvm::SmallString;
   using llvm::SmallVector;
   using llvm::SmallVectorImpl;
-  
+
+  // Reference counting.
+  using llvm::IntrusiveRefCntPtr;
+  using llvm::IntrusiveRefCntPtrInfo;
+  using llvm::RefCountedBase;
+  using llvm::RefCountedBaseVPTR;
+
   using llvm::raw_ostream;
 } // end namespace clang.
 

Modified: cfe/branches/tooling/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/LangOptions.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/LangOptions.h (original)
+++ cfe/branches/tooling/include/clang/Basic/LangOptions.h Tue Feb 21 15:38:41 2012
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_LANGOPTIONS_H
 
 #include <string>
+#include "clang/Basic/LLVM.h"
 #include "clang/Basic/Visibility.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 
@@ -22,7 +23,7 @@
 
 /// LangOptions - This class keeps track of the various options that can be
 /// enabled, which controls the dialect of C that is accepted.
-class LangOptions : public llvm::RefCountedBase<LangOptions> {
+class LangOptions : public RefCountedBase<LangOptions> {
 public:
   typedef clang::Visibility Visibility;
   

Modified: cfe/branches/tooling/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/SourceLocation.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/SourceLocation.h (original)
+++ cfe/branches/tooling/include/clang/Basic/SourceLocation.h Tue Feb 21 15:38:41 2012
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "llvm/Support/PointerLikeTypeTraits.h"
+#include "llvm/Support/Compiler.h"
 #include <utility>
 #include <functional>
 #include <cassert>
@@ -324,7 +325,7 @@
 
   /// Prints information about this FullSourceLoc to stderr. Useful for
   ///  debugging.
-  void dump() const { SourceLocation::dump(*SrcMgr); }
+  LLVM_ATTRIBUTE_USED void dump() const { SourceLocation::dump(*SrcMgr); }
 
   friend inline bool
   operator==(const FullSourceLoc &LHS, const FullSourceLoc &RHS) {

Modified: cfe/branches/tooling/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/SourceManager.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/SourceManager.h (original)
+++ cfe/branches/tooling/include/clang/Basic/SourceManager.h Tue Feb 21 15:38:41 2012
@@ -483,7 +483,7 @@
 /// the case of a macro expansion, for example, the spelling location indicates
 /// where the expanded token came from and the expansion location specifies
 /// where it was expanded.
-class SourceManager : public llvm::RefCountedBase<SourceManager> {
+class SourceManager : public RefCountedBase<SourceManager> {
   /// \brief DiagnosticsEngine object.
   DiagnosticsEngine &Diag;
 
@@ -519,7 +519,7 @@
   ///
   /// Negative FileIDs are indexes into this table. To get from ID to an index,
   /// use (-ID - 2).
-  std::vector<SrcMgr::SLocEntry> LoadedSLocEntryTable;
+  mutable std::vector<SrcMgr::SLocEntry> LoadedSLocEntryTable;
 
   /// \brief The starting offset of the next local SLocEntry.
   ///
@@ -576,6 +576,8 @@
   // Cache for the "fake" buffer used for error-recovery purposes.
   mutable llvm::MemoryBuffer *FakeBufferForRecovery;
 
+  mutable SrcMgr::ContentCache *FakeContentCacheForRecovery;
+
   /// \brief Lazily computed map of macro argument chunks to their expanded
   /// source location.
   typedef std::map<unsigned, SourceLocation> MacroArgsMap;
@@ -1260,9 +1262,9 @@
   const SrcMgr::SLocEntry &getLoadedSLocEntry(unsigned Index,
                                               bool *Invalid = 0) const {
     assert(Index < LoadedSLocEntryTable.size() && "Invalid index");
-    if (!SLocEntryLoaded[Index])
-      ExternalSLocEntries->ReadSLocEntry(-(static_cast<int>(Index) + 2));
-    return LoadedSLocEntryTable[Index];
+    if (SLocEntryLoaded[Index])
+      return LoadedSLocEntryTable[Index];
+    return loadSLocEntry(Index, Invalid);
   }
 
   const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = 0) const {
@@ -1313,6 +1315,9 @@
 
 private:
   const llvm::MemoryBuffer *getFakeBufferForRecovery() const;
+  const SrcMgr::ContentCache *getFakeContentCacheForRecovery() const;
+
+  const SrcMgr::SLocEntry &loadSLocEntry(unsigned Index, bool *Invalid) const;
 
   /// \brief Get the entry with the given unwrapped FileID.
   const SrcMgr::SLocEntry &getSLocEntryByID(int ID) const {
@@ -1322,8 +1327,9 @@
     return getLocalSLocEntry(static_cast<unsigned>(ID));
   }
 
-  const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID) const {
-    return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2));
+  const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID,
+                                                  bool *Invalid = 0) const {
+    return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2), Invalid);
   }
 
   /// createExpansionLoc - Implements the common elements of storing an

Modified: cfe/branches/tooling/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/TargetInfo.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/TargetInfo.h (original)
+++ cfe/branches/tooling/include/clang/Basic/TargetInfo.h Tue Feb 21 15:38:41 2012
@@ -59,7 +59,7 @@
 
 /// TargetInfo - This class exposes information about the current target.
 ///
-class TargetInfo : public llvm::RefCountedBase<TargetInfo> {
+class TargetInfo : public RefCountedBase<TargetInfo> {
   llvm::Triple Triple;
 protected:
   // Target values set by the ctor of the actual target implementation.  Default

Modified: cfe/branches/tooling/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/ASTUnit.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/ASTUnit.h Tue Feb 21 15:38:41 2012
@@ -61,7 +61,7 @@
 /// \brief Allocator for a cached set of global code completions.
 class GlobalCodeCompletionAllocator 
   : public CodeCompletionAllocator,
-    public llvm::RefCountedBase<GlobalCodeCompletionAllocator> 
+    public RefCountedBase<GlobalCodeCompletionAllocator>
 {
 
 };
@@ -70,14 +70,14 @@
 ///
 class ASTUnit : public ModuleLoader {
 private:
-  llvm::IntrusiveRefCntPtr<LangOptions>       LangOpts;
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
-  llvm::IntrusiveRefCntPtr<FileManager>       FileMgr;
-  llvm::IntrusiveRefCntPtr<SourceManager>     SourceMgr;
-  OwningPtr<HeaderSearch>                     HeaderInfo;
-  llvm::IntrusiveRefCntPtr<TargetInfo>        Target;
-  llvm::IntrusiveRefCntPtr<Preprocessor>      PP;
-  llvm::IntrusiveRefCntPtr<ASTContext>        Ctx;
+  IntrusiveRefCntPtr<LangOptions>       LangOpts;
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
+  IntrusiveRefCntPtr<FileManager>       FileMgr;
+  IntrusiveRefCntPtr<SourceManager>     SourceMgr;
+  OwningPtr<HeaderSearch>               HeaderInfo;
+  IntrusiveRefCntPtr<TargetInfo>        Target;
+  IntrusiveRefCntPtr<Preprocessor>      PP;
+  IntrusiveRefCntPtr<ASTContext>        Ctx;
   ASTReader *Reader;
 
   FileSystemOptions FileSystemOpts;
@@ -92,7 +92,7 @@
   
   /// Optional owned invocation, just used to make the invocation used in
   /// LoadFromCommandLine available.
-  llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation;
+  IntrusiveRefCntPtr<CompilerInvocation> Invocation;
   
   /// \brief The set of target features.
   ///
@@ -266,7 +266,7 @@
   /// \brief The language options used when we load an AST file.
   LangOptions ASTFileLangOpts;
 
-  static void ConfigureDiags(llvm::IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
+  static void ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
                              const char **ArgBegin, const char **ArgEnd,
                              ASTUnit &AST, bool CaptureDiagnostics);
 
@@ -324,14 +324,14 @@
   }
   
   /// \brief Retrieve the allocator used to cache global code completions.
-  llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> 
+  IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
   getCachedCompletionAllocator() {
     return CachedCompletionAllocator;
   }
   
   /// \brief Retrieve the allocator used to cache global code completions.
   /// Creates the allocator if it doesn't already exist.
-  llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+  IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
   getCursorCompletionAllocator() {
     if (!CursorCompletionAllocator.getPtr()) {
       CursorCompletionAllocator = new GlobalCodeCompletionAllocator;
@@ -341,11 +341,11 @@
   
 private:
   /// \brief Allocator used to store cached code completions.
-  llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+  IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
     CachedCompletionAllocator;
   
   /// \brief Allocator used to store code completions for arbitrary cursors.
-  llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+  IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
     CursorCompletionAllocator;
 
   /// \brief The set of cached code-completion results.
@@ -629,7 +629,7 @@
 
   /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation. 
   static ASTUnit *create(CompilerInvocation *CI,
-                         llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                         IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                          bool CaptureDiagnostics = false);
 
   /// \brief Create a ASTUnit from an AST file.
@@ -641,7 +641,7 @@
   ///
   /// \returns - The initialized ASTUnit or null if the AST failed to load.
   static ASTUnit *LoadFromASTFile(const std::string &Filename,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                   const FileSystemOptions &FileSystemOpts,
                                   bool OnlyLocalDecls = false,
                                   RemappedFile *RemappedFiles = 0,
@@ -680,7 +680,7 @@
   /// false means the caller is only interested in getting info through the
   /// provided \see Action.
   static ASTUnit *LoadFromCompilerInvocationAction(CompilerInvocation *CI,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                              ASTFrontendAction *Action = 0,
                                              ASTUnit *Unit = 0,
                                              bool Persistent = true,
@@ -702,7 +702,7 @@
   // FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
   // shouldn't need to specify them at construction time.
   static ASTUnit *LoadFromCompilerInvocation(CompilerInvocation *CI,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                              bool OnlyLocalDecls = false,
                                              bool CaptureDiagnostics = false,
                                              bool PrecompilePreamble = false,
@@ -726,7 +726,7 @@
   // shouldn't need to specify them at construction time.
   static ASTUnit *LoadFromCommandLine(const char **ArgBegin,
                                       const char **ArgEnd,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                       StringRef ResourceFilesPath,
                                       bool OnlyLocalDecls = false,
                                       bool CaptureDiagnostics = false,

Modified: cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h Tue Feb 21 15:38:41 2012
@@ -65,25 +65,25 @@
 /// and a long form that takes explicit instances of any required objects.
 class CompilerInstance : public ModuleLoader {
   /// The options used in this compiler instance.
-  llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation;
+  IntrusiveRefCntPtr<CompilerInvocation> Invocation;
 
   /// The diagnostics engine instance.
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
 
   /// The target being compiled for.
-  llvm::IntrusiveRefCntPtr<TargetInfo> Target;
+  IntrusiveRefCntPtr<TargetInfo> Target;
 
   /// The file manager.
-  llvm::IntrusiveRefCntPtr<FileManager> FileMgr;
+  IntrusiveRefCntPtr<FileManager> FileMgr;
 
   /// The source manager.
-  llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr;
+  IntrusiveRefCntPtr<SourceManager> SourceMgr;
 
   /// The preprocessor.
-  llvm::IntrusiveRefCntPtr<Preprocessor> PP;
+  IntrusiveRefCntPtr<Preprocessor> PP;
 
   /// The AST context.
-  llvm::IntrusiveRefCntPtr<ASTContext> Context;
+  IntrusiveRefCntPtr<ASTContext> Context;
 
   /// The AST consumer.
   OwningPtr<ASTConsumer> Consumer;
@@ -509,7 +509,7 @@
   /// used by some diagnostics printers (for logging purposes only).
   ///
   /// \return The new object on success, or null on failure.
-  static llvm::IntrusiveRefCntPtr<DiagnosticsEngine> 
+  static IntrusiveRefCntPtr<DiagnosticsEngine>
   createDiagnostics(const DiagnosticOptions &Opts, int Argc,
                     const char* const *Argv,
                     DiagnosticConsumer *Client = 0,

Modified: cfe/branches/tooling/include/clang/Frontend/CompilerInvocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/CompilerInvocation.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/CompilerInvocation.h Tue Feb 21 15:38:41 2012
@@ -34,10 +34,10 @@
 class CompilerInvocation;
 class DiagnosticsEngine;
   
-class CompilerInvocationBase : public llvm::RefCountedBase<CompilerInvocation> { 
+class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> {
 protected:
   /// Options controlling the language variant.
-  llvm::IntrusiveRefCntPtr<LangOptions> LangOpts;
+  IntrusiveRefCntPtr<LangOptions> LangOpts;
 public:
   CompilerInvocationBase();
 

Modified: cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h Tue Feb 21 15:38:41 2012
@@ -162,7 +162,7 @@
   
 public:
   PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
-                          DetailedRecordIncludesNestedMacroExpansions(true),
+                          DetailedRecordIncludesNestedMacroExpansions(false),
                           DisablePCHValidation(false), DisableStatCache(false),
                           DumpDeserializedPCHDecls(false),
                           PrecompiledPreambleBytes(0, true),

Modified: cfe/branches/tooling/include/clang/Frontend/Utils.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/Utils.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/Utils.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/Utils.h Tue Feb 21 15:38:41 2012
@@ -100,8 +100,8 @@
 /// argument vector.
 CompilerInvocation *
 createInvocationFromCommandLine(ArrayRef<const char *> Args,
-                            llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
-                                llvm::IntrusiveRefCntPtr<DiagnosticsEngine>());
+                            IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
+                                IntrusiveRefCntPtr<DiagnosticsEngine>());
 
 }  // end namespace clang
 

Modified: cfe/branches/tooling/include/clang/Lex/ModuleMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/ModuleMap.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/ModuleMap.h (original)
+++ cfe/branches/tooling/include/clang/Lex/ModuleMap.h Tue Feb 21 15:38:41 2012
@@ -37,7 +37,7 @@
   
 class ModuleMap {
   SourceManager *SourceMgr;
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
   const LangOptions &LangOpts;
   const TargetInfo *Target;
   

Modified: cfe/branches/tooling/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/Preprocessor.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/Preprocessor.h (original)
+++ cfe/branches/tooling/include/clang/Lex/Preprocessor.h Tue Feb 21 15:38:41 2012
@@ -60,7 +60,7 @@
 /// single source file, and don't know anything about preprocessor-level issues
 /// like the #include stack, token expansion, etc.
 ///
-class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
+class Preprocessor : public RefCountedBase<Preprocessor> {
   DiagnosticsEngine        *Diags;
   LangOptions       &Features;
   const TargetInfo  *Target;

Modified: cfe/branches/tooling/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Parse/Parser.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Parse/Parser.h (original)
+++ cfe/branches/tooling/include/clang/Parse/Parser.h Tue Feb 21 15:38:41 2012
@@ -2063,7 +2063,7 @@
                            bool SuppressDeclarations = false);
   void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType,
                                    Decl *TagDecl);
-  ExprResult ParseCXXMemberInitializer(bool IsFunction,
+  ExprResult ParseCXXMemberInitializer(Decl *D, bool IsFunction,
                                        SourceLocation &EqualLoc);
   void ParseCXXClassMemberDeclaration(AccessSpecifier AS, AttributeList *Attr,
                 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),

Modified: cfe/branches/tooling/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Sema.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Sema.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Sema.h Tue Feb 21 15:38:41 2012
@@ -572,11 +572,37 @@
     /// is indeed an unevaluated context.
     llvm::SmallVector<LambdaExpr *, 2> Lambdas;
 
+    /// \brief The declaration that provides context for the lambda expression
+    /// if the normal declaration context does not suffice, e.g., in a 
+    /// default function argument.
+    Decl *LambdaContextDecl;
+    
+    /// \brief The context information used to mangle lambda expressions
+    /// within this context.
+    ///
+    /// This mangling information is allocated lazily, since most contexts
+    /// do not have lambda expressions.
+    LambdaMangleContext *LambdaMangle;
+    
     ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context,
                                       unsigned NumCleanupObjects,
-                                      bool ParentNeedsCleanups)
+                                      bool ParentNeedsCleanups,
+                                      Decl *LambdaContextDecl)
       : Context(Context), ParentNeedsCleanups(ParentNeedsCleanups),
-        NumCleanupObjects(NumCleanupObjects) { }
+        NumCleanupObjects(NumCleanupObjects), 
+        LambdaContextDecl(LambdaContextDecl), LambdaMangle() { }
+    
+    ~ExpressionEvaluationContextRecord() {
+      delete LambdaMangle;
+    }
+    
+    /// \brief Retrieve the mangling context for lambdas.
+    LambdaMangleContext &getLambdaMangleContext() {
+      assert(LambdaContextDecl && "Need to have a lambda context declaration");
+      if (!LambdaMangle)
+        LambdaMangle = new LambdaMangleContext;
+      return *LambdaMangle;
+    }
   };
 
   /// A stack of expression evaluation contexts.
@@ -2288,7 +2314,8 @@
   void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
                              Expr **Args, unsigned NumArgs);
 
-  void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext);
+  void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext,
+                                       Decl *LambdaContextDecl = 0);
 
   void PopExpressionEvaluationContext();
 
@@ -2359,7 +2386,8 @@
   QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc);
   
   void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T);
-  void MarkDeclarationsReferencedInExpr(Expr *E);
+  void MarkDeclarationsReferencedInExpr(Expr *E, 
+                                        bool SkipLocalVariables = false);
 
   /// \brief Try to recover by turning the given expression into a
   /// call.  Returns true if recovery was attempted or an error was
@@ -3516,7 +3544,8 @@
   void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
 
   /// \brief Create a new lambda closure type.
-  CXXRecordDecl *createLambdaClosureType(SourceRange IntroducerRange);
+  CXXRecordDecl *createLambdaClosureType(SourceRange IntroducerRange,
+                                         bool KnownDependent = false);
   
   /// \brief Start the definition of a lambda expression.
   CXXMethodDecl *startLambdaDefinition(CXXRecordDecl *Class,
@@ -3555,7 +3584,11 @@
   /// ActOnLambdaExpr - This is called when the body of a lambda expression
   /// was successfully completed.
   ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
-                             Scope *CurScope, bool IsInstantiation = false);
+                             Scope *CurScope, 
+                             llvm::Optional<unsigned> ManglingNumber 
+                               = llvm::Optional<unsigned>(),
+                             Decl *ContextDecl = 0,
+                             bool IsInstantiation = false);
 
   /// \brief Define the "body" of the conversion from a lambda object to a 
   /// function pointer.
@@ -6538,9 +6571,10 @@
 
 public:
   EnterExpressionEvaluationContext(Sema &Actions,
-                                   Sema::ExpressionEvaluationContext NewContext)
+                                   Sema::ExpressionEvaluationContext NewContext,
+                                   Decl *LambdaContextDecl = 0)
     : Actions(Actions) {
-    Actions.PushExpressionEvaluationContext(NewContext);
+    Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl);
   }
 
   ~EnterExpressionEvaluationContext() {

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Tue Feb 21 15:38:41 2012
@@ -260,7 +260,7 @@
 // Path "pieces" for path-sensitive diagnostics.
 //===----------------------------------------------------------------------===//
 
-class PathDiagnosticPiece : public llvm::RefCountedBaseVPTR {
+class PathDiagnosticPiece : public RefCountedBaseVPTR {
 public:
   enum Kind { ControlFlow, Event, Macro, CallEnter, CallExit };
   enum DisplayHint { Above, Below };
@@ -326,7 +326,7 @@
   
   
 class PathPieces :
-  public std::deque<llvm::IntrusiveRefCntPtr<PathDiagnosticPiece> > {
+  public std::deque<IntrusiveRefCntPtr<PathDiagnosticPiece> > {
 public:
   ~PathPieces();  
 };

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h Tue Feb 21 15:38:41 2012
@@ -10,6 +10,7 @@
 #ifndef LLVM_CLANG_PROGRAMSTATE_FWD_H
 #define LLVM_CLANG_PROGRAMSTATE_FWD_H
 
+#include "clang/Basic/LLVM.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 
 namespace clang {
@@ -34,7 +35,7 @@
 
 namespace clang {
 namespace ento {
-  typedef llvm::IntrusiveRefCntPtr<const ProgramState> ProgramStateRef;
+  typedef IntrusiveRefCntPtr<const ProgramState> ProgramStateRef;
 }
 }
 

Modified: cfe/branches/tooling/lib/ARCMigrate/ARCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/ARCMT.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/ARCMT.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/ARCMT.cpp Tue Feb 21 15:38:41 2012
@@ -206,8 +206,8 @@
                                    const DiagnosticOptions &diagOpts,
                                    Preprocessor &PP) {
   TextDiagnosticPrinter printer(llvm::errs(), diagOpts);
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, &printer, /*ShouldOwnClient=*/false));
   Diags->setSourceManager(&PP.getSourceManager());
   
@@ -244,8 +244,8 @@
   CapturedDiagList capturedDiags;
 
   assert(DiagClient);
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   // Filter of all diagnostics.
@@ -349,8 +349,8 @@
     if (err) return true;
   }
 
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   if (outputDir.empty()) {
@@ -388,8 +388,8 @@
                               DiagnosticConsumer *DiagClient) {
   assert(!outputDir.empty());
 
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   FileRemapper remapper;
@@ -491,8 +491,8 @@
                                    StringRef outputDir)
   : OrigCI(CI), DiagClient(diagClient) {
   if (!outputDir.empty()) {
-    llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+    IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+    IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
     Remapper.initFromDisk(outputDir, *Diags, /*ignoreIfFilesChanges=*/true);
   }
@@ -510,8 +510,8 @@
   std::vector<SourceLocation> ARCMTMacroLocs;
 
   assert(DiagClient);
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   // Filter of all diagnostics.

Modified: cfe/branches/tooling/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ASTContext.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ASTContext.cpp (original)
+++ cfe/branches/tooling/lib/AST/ASTContext.cpp Tue Feb 21 15:38:41 2012
@@ -6748,6 +6748,13 @@
     + llvm::capacity_in_bytes(ClassScopeSpecializationPattern);
 }
 
+unsigned ASTContext::getLambdaManglingNumber(CXXMethodDecl *CallOperator) {
+  CXXRecordDecl *Lambda = CallOperator->getParent();
+  return LambdaMangleContexts[Lambda->getDeclContext()]
+           .getManglingNumber(CallOperator);
+}
+
+
 void ASTContext::setParameterIndex(const ParmVarDecl *D, unsigned int index) {
   ParamIndices[D] = index;
 }

Modified: cfe/branches/tooling/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ASTImporter.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ASTImporter.cpp (original)
+++ cfe/branches/tooling/lib/AST/ASTImporter.cpp Tue Feb 21 15:38:41 2012
@@ -3088,7 +3088,9 @@
                                           Loc, 
                                        Importer.Import(D->getCategoryNameLoc()), 
                                           Name.getAsIdentifierInfo(),
-                                          ToInterface);
+                                          ToInterface,
+                                       Importer.Import(D->getIvarLBraceLoc()),
+                                       Importer.Import(D->getIvarRBraceLoc()));
     ToCategory->setLexicalDeclContext(LexicalDC);
     LexicalDC->addDeclInternal(ToCategory);
     Importer.Imported(D, ToCategory);
@@ -3434,7 +3436,9 @@
                                   Importer.ImportContext(D->getDeclContext()),
                                           Iface, Super,
                                           Importer.Import(D->getLocation()),
-                                          Importer.Import(D->getAtStartLoc()));
+                                          Importer.Import(D->getAtStartLoc()),
+                                          Importer.Import(D->getIvarLBraceLoc()),
+                                          Importer.Import(D->getIvarRBraceLoc()));
     
     if (D->getDeclContext() != D->getLexicalDeclContext()) {
       DeclContext *LexicalDC

Modified: cfe/branches/tooling/lib/AST/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/CMakeLists.txt?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/CMakeLists.txt (original)
+++ cfe/branches/tooling/lib/AST/CMakeLists.txt Tue Feb 21 15:38:41 2012
@@ -28,6 +28,7 @@
   InheritViz.cpp
   ItaniumCXXABI.cpp
   ItaniumMangle.cpp
+  LambdaMangleContext.cpp
   Mangle.cpp
   MicrosoftCXXABI.cpp
   MicrosoftMangle.cpp

Modified: cfe/branches/tooling/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Decl.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Decl.cpp (original)
+++ cfe/branches/tooling/lib/AST/Decl.cpp Tue Feb 21 15:38:41 2012
@@ -734,6 +734,32 @@
     case Decl::ObjCPropertyImpl:
     case Decl::ObjCProtocol:
       return LinkageInfo::external();
+      
+    case Decl::CXXRecord: {
+      const CXXRecordDecl *Record = cast<CXXRecordDecl>(D);
+      if (Record->isLambda()) {
+        if (!Record->getLambdaManglingNumber()) {
+          // This lambda has no mangling number, so it's internal.
+          return LinkageInfo::internal();
+        }
+        
+        // This lambda has its linkage/visibility determined by its owner.
+        const DeclContext *DC = D->getDeclContext()->getRedeclContext();
+        if (Decl *ContextDecl = Record->getLambdaContextDecl()) {
+          if (isa<ParmVarDecl>(ContextDecl))
+            DC = ContextDecl->getDeclContext()->getRedeclContext();
+          else
+            return getLVForDecl(cast<NamedDecl>(ContextDecl), Flags);
+        }
+
+        if (const NamedDecl *ND = dyn_cast<NamedDecl>(DC))
+          return getLVForDecl(ND, Flags);
+        
+        return LinkageInfo::external();
+      }
+      
+      break;
+    }
   }
 
   // Handle linkage for namespace-scope names.

Modified: cfe/branches/tooling/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclBase.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclBase.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclBase.cpp Tue Feb 21 15:38:41 2012
@@ -741,10 +741,14 @@
   if (isa<ClassTemplatePartialSpecializationDecl>(this))
     return true;
 
-  if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(this))
+  if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(this)) {
     if (Record->getDescribedClassTemplate())
       return true;
-
+    
+    if (Record->isDependentLambda())
+      return true;
+  }
+  
   if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(this)) {
     if (Function->getDescribedFunctionTemplate())
       return true;

Modified: cfe/branches/tooling/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclCXX.cpp Tue Feb 21 15:38:41 2012
@@ -83,11 +83,11 @@
 }
 
 CXXRecordDecl *CXXRecordDecl::CreateLambda(const ASTContext &C, DeclContext *DC,
-                                           SourceLocation Loc) {
+                                           SourceLocation Loc, bool Dependent) {
   CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TTK_Class, DC, Loc, Loc,
                                            0, 0);
   R->IsBeingDefined = true;
-  R->DefinitionData = new (C) struct LambdaDefinitionData(R);
+  R->DefinitionData = new (C) struct LambdaDefinitionData(R, Dependent);
   C.getTypeDeclType(R, /*PrevDecl=*/0);
   return R;
 }

Modified: cfe/branches/tooling/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclObjC.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclObjC.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclObjC.cpp Tue Feb 21 15:38:41 2012
@@ -1070,10 +1070,13 @@
                                            SourceLocation ClassNameLoc,
                                            SourceLocation CategoryNameLoc,
                                            IdentifierInfo *Id,
-                                           ObjCInterfaceDecl *IDecl) {
+                                           ObjCInterfaceDecl *IDecl,
+                                           SourceLocation IvarLBraceLoc,
+                                           SourceLocation IvarRBraceLoc) {
   ObjCCategoryDecl *CatDecl = new (C) ObjCCategoryDecl(DC, AtLoc, ClassNameLoc,
                                                        CategoryNameLoc, Id,
-                                                       IDecl);
+                                                       IDecl,
+                                                       IvarLBraceLoc, IvarRBraceLoc);
   if (IDecl) {
     // Link this category into its class's category list.
     CatDecl->NextClassCategory = IDecl->getCategoryList();
@@ -1209,11 +1212,14 @@
                                ObjCInterfaceDecl *ClassInterface,
                                ObjCInterfaceDecl *SuperDecl,
                                SourceLocation nameLoc,
-                               SourceLocation atStartLoc) {
+                               SourceLocation atStartLoc,
+                               SourceLocation IvarLBraceLoc,
+                               SourceLocation IvarRBraceLoc) {
   if (ClassInterface && ClassInterface->hasDefinition())
     ClassInterface = ClassInterface->getDefinition();
   return new (C) ObjCImplementationDecl(DC, ClassInterface, SuperDecl,
-                                        nameLoc, atStartLoc);
+                                        nameLoc, atStartLoc,
+                                        IvarLBraceLoc, IvarRBraceLoc);
 }
 
 ObjCImplementationDecl *

Modified: cfe/branches/tooling/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Expr.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Expr.cpp (original)
+++ cfe/branches/tooling/lib/AST/Expr.cpp Tue Feb 21 15:38:41 2012
@@ -2979,8 +2979,8 @@
     MyArgs[I] = Args[I];
   }
 
+  SelLocsKind = SelLocsK;
   if (!isImplicit()) {
-    SelLocsKind = SelLocsK;
     if (SelLocsK == SelLoc_NonStandard)
       std::copy(SelLocs.begin(), SelLocs.end(), getStoredSelLocs());
   }

Modified: cfe/branches/tooling/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ExprCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/AST/ExprCXX.cpp Tue Feb 21 15:38:41 2012
@@ -764,7 +764,9 @@
                        ArrayRef<Expr *> CaptureInits,
                        ArrayRef<VarDecl *> ArrayIndexVars,
                        ArrayRef<unsigned> ArrayIndexStarts,
-                       SourceLocation ClosingBrace)
+                       SourceLocation ClosingBrace,
+                       unsigned ManglingNumber,
+                       Decl *ContextDecl)
   : Expr(LambdaExprClass, T, VK_RValue, OK_Ordinary,
          T->isDependentType(), T->isDependentType(), T->isDependentType(),
          /*ContainsUnexpandedParameterPack=*/false),
@@ -785,6 +787,8 @@
   ASTContext &Context = Class->getASTContext();
   Data.NumCaptures = NumCaptures;
   Data.NumExplicitCaptures = 0;
+  Data.ManglingNumber = ManglingNumber;
+  Data.ContextDecl = ContextDecl;
   Data.Captures = (Capture *)Context.Allocate(sizeof(Capture) * NumCaptures);
   Capture *ToCapture = Data.Captures;
   for (unsigned I = 0, N = Captures.size(); I != N; ++I) {
@@ -811,7 +815,10 @@
     memcpy(getArrayIndexStarts(), ArrayIndexStarts.data(), 
            sizeof(unsigned) * Captures.size());
     getArrayIndexStarts()[Captures.size()] = ArrayIndexVars.size();
-  }  
+  }
+  
+  if (ManglingNumber)
+    Class->ClearLinkageCache();
 }
 
 LambdaExpr *LambdaExpr::Create(ASTContext &Context, 
@@ -824,7 +831,9 @@
                                ArrayRef<Expr *> CaptureInits,
                                ArrayRef<VarDecl *> ArrayIndexVars,
                                ArrayRef<unsigned> ArrayIndexStarts,
-                               SourceLocation ClosingBrace) {
+                               SourceLocation ClosingBrace,
+                               unsigned ManglingNumber,
+                               Decl *ContextDecl) {
   // Determine the type of the expression (i.e., the type of the
   // function object we're creating).
   QualType T = Context.getTypeDeclType(Class);
@@ -837,7 +846,7 @@
   return new (Mem) LambdaExpr(T, IntroducerRange, CaptureDefault, 
                               Captures, ExplicitParams, ExplicitResultType,
                               CaptureInits, ArrayIndexVars, ArrayIndexStarts,
-                              ClosingBrace);
+                              ClosingBrace, ManglingNumber, ContextDecl);
 }
 
 LambdaExpr *LambdaExpr::CreateDeserialized(ASTContext &C, unsigned NumCaptures,

Modified: cfe/branches/tooling/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ExprConstant.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/AST/ExprConstant.cpp Tue Feb 21 15:38:41 2012
@@ -3513,6 +3513,10 @@
 }
 
 bool RecordExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
+  // Cannot constant-evaluate std::initializer_list inits.
+  if (E->initializesStdInitializerList())
+    return false;
+
   const RecordDecl *RD = E->getType()->castAs<RecordType>()->getDecl();
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
 

Modified: cfe/branches/tooling/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ItaniumMangle.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/branches/tooling/lib/AST/ItaniumMangle.cpp Tue Feb 21 15:38:41 2012
@@ -40,14 +40,38 @@
 
 namespace {
 
+/// \brief Retrieve the declaration context that should be used when mangling 
+/// the given declaration.
+static const DeclContext *getEffectiveDeclContext(const Decl *D) {
+  // The ABI assumes that lambda closure types that occur within 
+  // default arguments live in the context of the function. However, due to
+  // the way in which Clang parses and creates function declarations, this is
+  // not the case: the lambda closure type ends up living in the context 
+  // where the function itself resides, because the function declaration itself
+  // had not yet been created. Fix the context here.
+  if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
+    if (RD->isLambda())
+      if (ParmVarDecl *ContextParam
+            = dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl()))
+        return ContextParam->getDeclContext();
+  }
+  
+  return D->getDeclContext();
+}
+
+static const DeclContext *getEffectiveParentContext(const DeclContext *DC) {
+  return getEffectiveDeclContext(cast<Decl>(DC));
+}
+  
 static const CXXRecordDecl *GetLocalClassDecl(const NamedDecl *ND) {
   const DeclContext *DC = dyn_cast<DeclContext>(ND);
   if (!DC)
-    DC = ND->getDeclContext();
+    DC = getEffectiveDeclContext(ND);
   while (!DC->isNamespace() && !DC->isTranslationUnit()) {
-    if (isa<FunctionDecl>(DC->getParent()))
+    const DeclContext *Parent = getEffectiveDeclContext(cast<Decl>(DC));
+    if (isa<FunctionDecl>(Parent))
       return dyn_cast<CXXRecordDecl>(DC);
-    DC = DC->getParent();
+    DC = Parent;
   }
   return 0;
 }
@@ -63,7 +87,7 @@
   const FunctionDecl *fn = dyn_cast_or_null<FunctionDecl>(decl);
   return (fn ? getStructor(fn) : decl);
 }
-
+                                                    
 static const unsigned UnknownArity = ~0U;
 
 class ItaniumMangleContext : public MangleContext {
@@ -122,6 +146,13 @@
   }
 
   bool getNextDiscriminator(const NamedDecl *ND, unsigned &disc) {
+    // Lambda closure types with external linkage (indicated by a 
+    // non-zero lambda mangling number) have their own numbering scheme, so
+    // they do not need a discriminator.
+    if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(ND))
+      if (RD->isLambda() && RD->getLambdaManglingNumber() > 0)
+        return false;
+        
     unsigned &discriminator = Uniquifier[ND];
     if (!discriminator)
       discriminator = ++Discriminator;
@@ -272,6 +303,7 @@
   void mangleUnscopedTemplateName(TemplateName);
   void mangleSourceName(const IdentifierInfo *II);
   void mangleLocalName(const NamedDecl *ND);
+  void mangleLambda(const CXXRecordDecl *Lambda);
   void mangleNestedName(const NamedDecl *ND, const DeclContext *DC,
                         bool NoFunction=false);
   void mangleNestedName(const TemplateDecl *TD,
@@ -332,8 +364,8 @@
 
 static bool isInCLinkageSpecification(const Decl *D) {
   D = D->getCanonicalDecl();
-  for (const DeclContext *DC = D->getDeclContext();
-       !DC->isTranslationUnit(); DC = DC->getParent()) {
+  for (const DeclContext *DC = getEffectiveDeclContext(D);
+       !DC->isTranslationUnit(); DC = getEffectiveParentContext(DC)) {
     if (const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(DC))
       return Linkage->getLanguage() == LinkageSpecDecl::lang_c;
   }
@@ -365,17 +397,17 @@
 
   // Variables at global scope with non-internal linkage are not mangled
   if (!FD) {
-    const DeclContext *DC = D->getDeclContext();
+    const DeclContext *DC = getEffectiveDeclContext(D);
     // Check for extern variable declared locally.
     if (DC->isFunctionOrMethod() && D->hasLinkage())
       while (!DC->isNamespace() && !DC->isTranslationUnit())
-        DC = DC->getParent();
+        DC = getEffectiveParentContext(DC);
     if (DC->isTranslationUnit() && D->getLinkage() != InternalLinkage)
       return false;
   }
 
   // Class members are always mangled.
-  if (D->getDeclContext()->isRecord())
+  if (getEffectiveDeclContext(D)->isRecord())
     return true;
 
   // C functions and "main" are not mangled.
@@ -458,7 +490,7 @@
 
 static const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC) {
   while (isa<LinkageSpecDecl>(DC)) {
-    DC = DC->getParent();
+    DC = getEffectiveParentContext(DC);
   }
 
   return DC;
@@ -466,7 +498,8 @@
 
 /// isStd - Return whether a given namespace is the 'std' namespace.
 static bool isStd(const NamespaceDecl *NS) {
-  if (!IgnoreLinkageSpecDecls(NS->getParent())->isTranslationUnit())
+  if (!IgnoreLinkageSpecDecls(getEffectiveParentContext(NS))
+                                ->isTranslationUnit())
     return false;
   
   const IdentifierInfo *II = NS->getOriginalNamespace()->getIdentifier();
@@ -508,20 +541,20 @@
   //         ::= <unscoped-template-name> <template-args>
   //         ::= <local-name>
   //
-  const DeclContext *DC = ND->getDeclContext();
+  const DeclContext *DC = getEffectiveDeclContext(ND);
 
   // If this is an extern variable declared locally, the relevant DeclContext
   // is that of the containing namespace, or the translation unit.
   if (isa<FunctionDecl>(DC) && ND->hasLinkage())
     while (!DC->isNamespace() && !DC->isTranslationUnit())
-      DC = DC->getParent();
+      DC = getEffectiveParentContext(DC);
   else if (GetLocalClassDecl(ND)) {
     mangleLocalName(ND);
     return;
   }
 
   while (isa<LinkageSpecDecl>(DC))
-    DC = DC->getParent();
+    DC = getEffectiveParentContext(DC);
 
   if (DC->isTranslationUnit() || isStdNamespace(DC)) {
     // Check if we have a template.
@@ -547,7 +580,7 @@
 void CXXNameMangler::mangleName(const TemplateDecl *TD,
                                 const TemplateArgument *TemplateArgs,
                                 unsigned NumTemplateArgs) {
-  const DeclContext *DC = IgnoreLinkageSpecDecls(TD->getDeclContext());
+  const DeclContext *DC = IgnoreLinkageSpecDecls(getEffectiveDeclContext(TD));
 
   if (DC->isTranslationUnit() || isStdNamespace(DC)) {
     mangleUnscopedTemplateName(TD);
@@ -561,7 +594,7 @@
 void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
   //  <unscoped-name> ::= <unqualified-name>
   //                  ::= St <unqualified-name>   # ::std::
-  if (isStdNamespace(ND->getDeclContext()))
+  if (isStdNamespace(getEffectiveDeclContext(ND)))
     Out << "St";
 
   mangleUnqualifiedName(ND);
@@ -1021,7 +1054,7 @@
       // This naming convention is the same as that followed by GCC,
       // though it shouldn't actually matter.
       if (ND && ND->getLinkage() == InternalLinkage &&
-          ND->getDeclContext()->isFileContext())
+          getEffectiveDeclContext(ND)->isFileContext())
         Out << 'L';
 
       mangleSourceName(II);
@@ -1076,6 +1109,17 @@
       break;
     }
 
+    // <unnamed-type-name> ::= <closure-type-name>
+    // 
+    // <closure-type-name> ::= Ul <lambda-sig> E [ <nonnegative number> ] _
+    // <lambda-sig> ::= <parameter-type>+   # Parameter types or 'v' for 'void'.
+    if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(TD)) {
+      if (Record->isLambda() && Record->getLambdaManglingNumber()) {
+        mangleLambda(Record);
+        break;
+      }
+    }
+        
     // Get a unique id for the anonymous struct.
     uint64_t AnonStructId = Context.getAnonymousStructId(TD);
 
@@ -1204,8 +1248,10 @@
 void CXXNameMangler::mangleLocalName(const NamedDecl *ND) {
   // <local-name> := Z <function encoding> E <entity name> [<discriminator>]
   //              := Z <function encoding> E s [<discriminator>]
+  // <local-name> := Z <function encoding> E d [ <parameter number> ] 
+  //                 _ <entity name>
   // <discriminator> := _ <non-negative number>
-  const DeclContext *DC = ND->getDeclContext();
+  const DeclContext *DC = getEffectiveDeclContext(ND);
   if (isa<ObjCMethodDecl>(DC) && isa<FunctionDecl>(ND)) {
     // Don't add objc method name mangling to locally declared function
     mangleUnqualifiedName(ND);
@@ -1217,23 +1263,46 @@
   if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC)) {
    mangleObjCMethodName(MD);
   } else if (const CXXRecordDecl *RD = GetLocalClassDecl(ND)) {
-    mangleFunctionEncoding(cast<FunctionDecl>(RD->getDeclContext()));
+    mangleFunctionEncoding(cast<FunctionDecl>(getEffectiveDeclContext(RD)));
     Out << 'E';
 
+    // The parameter number is omitted for the last parameter, 0 for the 
+    // second-to-last parameter, 1 for the third-to-last parameter, etc. The 
+    // <entity name> will of course contain a <closure-type-name>: Its 
+    // numbering will be local to the particular argument in which it appears
+    // -- other default arguments do not affect its encoding.
+    bool SkipDiscriminator = false;
+    if (RD->isLambda()) {
+      if (const ParmVarDecl *Parm
+                 = dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl())) {
+        if (const FunctionDecl *Func
+              = dyn_cast<FunctionDecl>(Parm->getDeclContext())) {
+          Out << 'd';
+          unsigned Num = Func->getNumParams() - Parm->getFunctionScopeIndex();
+          if (Num > 1)
+            mangleNumber(Num - 2);
+          Out << '_';
+          SkipDiscriminator = true;
+        }
+      }
+    }
+    
     // Mangle the name relative to the closest enclosing function.
     if (ND == RD) // equality ok because RD derived from ND above
       mangleUnqualifiedName(ND);
     else
       mangleNestedName(ND, DC, true /*NoFunction*/);
 
-    unsigned disc;
-    if (Context.getNextDiscriminator(RD, disc)) {
-      if (disc < 10)
-        Out << '_' << disc;
-      else
-        Out << "__" << disc << '_';
+    if (!SkipDiscriminator) {
+      unsigned disc;
+      if (Context.getNextDiscriminator(RD, disc)) {
+        if (disc < 10)
+          Out << '_' << disc;
+        else
+          Out << "__" << disc << '_';
+      }
     }
-
+    
     return;
   }
   else
@@ -1243,6 +1312,48 @@
   mangleUnqualifiedName(ND);
 }
 
+void CXXNameMangler::mangleLambda(const CXXRecordDecl *Lambda) {
+  // If the context of a closure type is an initializer for a class member 
+  // (static or nonstatic), it is encoded in a qualified name with a final 
+  // <prefix> of the form:
+  //
+  //   <data-member-prefix> := <member source-name> M
+  //
+  // Technically, the data-member-prefix is part of the <prefix>. However,
+  // since a closure type will always be mangled with a prefix, it's easier
+  // to emit that last part of the prefix here.
+  if (Decl *Context = Lambda->getLambdaContextDecl()) {
+    if ((isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
+        Context->getDeclContext()->isRecord()) {
+      if (const IdentifierInfo *Name
+            = cast<NamedDecl>(Context)->getIdentifier()) {
+        mangleSourceName(Name);
+        Out << 'M';            
+      }
+    }
+  }
+
+  Out << "Ul";
+  DeclarationName Name
+    = getASTContext().DeclarationNames.getCXXOperatorName(OO_Call);
+  const FunctionProtoType *Proto
+    = cast<CXXMethodDecl>(*Lambda->lookup(Name).first)->getType()->
+        getAs<FunctionProtoType>();
+  mangleBareFunctionType(Proto, /*MangleReturnType=*/false);        
+  Out << "E";
+  
+  // The number is omitted for the first closure type with a given 
+  // <lambda-sig> in a given context; it is n-2 for the nth closure type 
+  // (in lexical order) with that same <lambda-sig> and context.
+  //
+  // The AST keeps track of the number for us.
+  unsigned Number = Lambda->getLambdaManglingNumber();
+  assert(Number > 0 && "Lambda should be mangled as an unnamed class");
+  if (Number > 1)
+    mangleNumber(Number - 2);
+  Out << '_';  
+}
+
 void CXXNameMangler::manglePrefix(NestedNameSpecifier *qualifier) {
   switch (qualifier->getKind()) {
   case NestedNameSpecifier::Global:
@@ -1283,13 +1394,13 @@
   //           ::= <substitution>
 
   while (isa<LinkageSpecDecl>(DC))
-    DC = DC->getParent();
+    DC = getEffectiveParentContext(DC);
 
   if (DC->isTranslationUnit())
     return;
 
   if (const BlockDecl *Block = dyn_cast<BlockDecl>(DC)) {
-    manglePrefix(DC->getParent(), NoFunction);    
+    manglePrefix(getEffectiveParentContext(DC), NoFunction);    
     SmallString<64> Name;
     llvm::raw_svector_ostream NameStream(Name);
     Context.mangleBlock(Block, NameStream);
@@ -1298,26 +1409,27 @@
     return;
   }
   
-  if (mangleSubstitution(cast<NamedDecl>(DC)))
+  const NamedDecl *ND = cast<NamedDecl>(DC);  
+  if (mangleSubstitution(ND))
     return;
-
+  
   // Check if we have a template.
   const TemplateArgumentList *TemplateArgs = 0;
-  if (const TemplateDecl *TD = isTemplate(cast<NamedDecl>(DC), TemplateArgs)) {
+  if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
     mangleTemplatePrefix(TD);
     TemplateParameterList *TemplateParameters = TD->getTemplateParameters();
     mangleTemplateArgs(*TemplateParameters, *TemplateArgs);
   }
-  else if(NoFunction && (isa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC)))
+  else if(NoFunction && (isa<FunctionDecl>(ND) || isa<ObjCMethodDecl>(ND)))
     return;
-  else if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(DC))
+  else if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(ND))
     mangleObjCMethodName(Method);
   else {
-    manglePrefix(DC->getParent(), NoFunction);
-    mangleUnqualifiedName(cast<NamedDecl>(DC));
+    manglePrefix(getEffectiveDeclContext(ND), NoFunction);
+    mangleUnqualifiedName(ND);
   }
 
-  addSubstitution(cast<NamedDecl>(DC));
+  addSubstitution(ND);
 }
 
 void CXXNameMangler::mangleTemplatePrefix(TemplateName Template) {
@@ -1360,7 +1472,7 @@
     return;
   }
 
-  manglePrefix(ND->getDeclContext());
+  manglePrefix(getEffectiveDeclContext(ND));
   mangleUnqualifiedName(ND->getTemplatedDecl());
   addSubstitution(ND);
 }
@@ -3120,7 +3232,7 @@
   if (!SD)
     return false;
 
-  if (!isStdNamespace(SD->getDeclContext()))
+  if (!isStdNamespace(getEffectiveDeclContext(SD)))
     return false;
 
   const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
@@ -3162,7 +3274,7 @@
   }
 
   if (const ClassTemplateDecl *TD = dyn_cast<ClassTemplateDecl>(ND)) {
-    if (!isStdNamespace(TD->getDeclContext()))
+    if (!isStdNamespace(getEffectiveDeclContext(TD)))
       return false;
 
     // <substitution> ::= Sa # ::std::allocator
@@ -3180,7 +3292,7 @@
 
   if (const ClassTemplateSpecializationDecl *SD =
         dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
-    if (!isStdNamespace(SD->getDeclContext()))
+    if (!isStdNamespace(getEffectiveDeclContext(SD)))
       return false;
 
     //    <substitution> ::= Ss # ::std::basic_string<char,

Modified: cfe/branches/tooling/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Diagnostic.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Diagnostic.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Diagnostic.cpp Tue Feb 21 15:38:41 2012
@@ -34,7 +34,7 @@
 
 
 DiagnosticsEngine::DiagnosticsEngine(
-                       const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags,
+                       const IntrusiveRefCntPtr<DiagnosticIDs> &diags,
                        DiagnosticConsumer *client, bool ShouldOwnClient)
   : Diags(diags), Client(client), OwnsDiagClient(ShouldOwnClient),
     SourceMgr(0) {

Modified: cfe/branches/tooling/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/SourceManager.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/SourceManager.cpp (original)
+++ cfe/branches/tooling/lib/Basic/SourceManager.cpp Tue Feb 21 15:38:41 2012
@@ -370,7 +370,8 @@
 SourceManager::SourceManager(DiagnosticsEngine &Diag, FileManager &FileMgr)
   : Diag(Diag), FileMgr(FileMgr), OverridenFilesKeepOriginalName(true),
     ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
-    NumBinaryProbes(0), FakeBufferForRecovery(0) {
+    NumBinaryProbes(0), FakeBufferForRecovery(0),
+    FakeContentCacheForRecovery(0) {
   clearIDTables();
   Diag.setSourceManager(this);
 }
@@ -396,6 +397,7 @@
   }
   
   delete FakeBufferForRecovery;
+  delete FakeContentCacheForRecovery;
 
   for (llvm::DenseMap<FileID, MacroArgsMap *>::iterator
          I = MacroArgsCacheMap.begin(),E = MacroArgsCacheMap.end(); I!=E; ++I) {
@@ -469,6 +471,25 @@
   return Entry;
 }
 
+const SrcMgr::SLocEntry &SourceManager::loadSLocEntry(unsigned Index,
+                                                      bool *Invalid) const {
+  assert(!SLocEntryLoaded[Index]);
+  if (ExternalSLocEntries->ReadSLocEntry(-(static_cast<int>(Index) + 2))) {
+    if (Invalid)
+      *Invalid = true;
+    // If the file of the SLocEntry changed we could still have loaded it.
+    if (!SLocEntryLoaded[Index]) {
+      // Try to recover; create a SLocEntry so the rest of clang can handle it.
+      LoadedSLocEntryTable[Index] = SLocEntry::get(0,
+                                 FileInfo::get(SourceLocation(),
+                                               getFakeContentCacheForRecovery(),
+                                               SrcMgr::C_User));
+    }
+  }
+
+  return LoadedSLocEntryTable[Index];
+}
+
 std::pair<int, unsigned>
 SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries,
                                          unsigned TotalSize) {
@@ -491,6 +512,18 @@
   return FakeBufferForRecovery;
 }
 
+/// \brief As part of recovering from missing or changed content, produce a
+/// fake content cache.
+const SrcMgr::ContentCache *
+SourceManager::getFakeContentCacheForRecovery() const {
+  if (!FakeContentCacheForRecovery) {
+    FakeContentCacheForRecovery = new ContentCache();
+    FakeContentCacheForRecovery->replaceBuffer(getFakeBufferForRecovery(),
+                                               /*DoNotFree=*/true);
+  }
+  return FakeContentCacheForRecovery;
+}
+
 //===----------------------------------------------------------------------===//
 // Methods to create new FileID's and macro expansions.
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp Tue Feb 21 15:38:41 2012
@@ -2240,6 +2240,8 @@
       ID = Intrinsic::x86_3dnowa_pswapd;
       break;
     }
+    llvm::Type *MMXTy = llvm::Type::getX86_MMXTy(getLLVMContext());
+    Ops[0] = Builder.CreateBitCast(Ops[0], MMXTy, "cast");
     llvm::Function *F = CGM.getIntrinsic(ID);
     return Builder.CreateCall(F, Ops, name);
   }

Modified: cfe/branches/tooling/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGClass.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGClass.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGClass.cpp Tue Feb 21 15:38:41 2012
@@ -418,40 +418,46 @@
                                      ArrayRef<VarDecl *> ArrayIndexes,
                                      unsigned Index) {
   if (Index == ArrayIndexes.size()) {
-    CodeGenFunction::RunCleanupsScope Cleanups(CGF);
-
     LValue LV = LHS;
-    if (ArrayIndexVar) {
-      // If we have an array index variable, load it and use it as an offset.
-      // Then, increment the value.
-      llvm::Value *Dest = LHS.getAddress();
-      llvm::Value *ArrayIndex = CGF.Builder.CreateLoad(ArrayIndexVar);
-      Dest = CGF.Builder.CreateInBoundsGEP(Dest, ArrayIndex, "destaddress");
-      llvm::Value *Next = llvm::ConstantInt::get(ArrayIndex->getType(), 1);
-      Next = CGF.Builder.CreateAdd(ArrayIndex, Next, "inc");
-      CGF.Builder.CreateStore(Next, ArrayIndexVar);    
-
-      // Update the LValue.
-      LV.setAddress(Dest);
-      CharUnits Align = CGF.getContext().getTypeAlignInChars(T);
-      LV.setAlignment(std::min(Align, LV.getAlignment()));
-    }
-
-    if (!CGF.hasAggregateLLVMType(T)) {
-      CGF.EmitScalarInit(Init, /*decl*/ 0, LV, false);
-    } else if (T->isAnyComplexType()) {
-      CGF.EmitComplexExprIntoAddr(Init, LV.getAddress(),
-                                  LV.isVolatileQualified());
-    } else {
-      AggValueSlot Slot =
-        AggValueSlot::forLValue(LV,
-                                AggValueSlot::IsDestructed,
-                                AggValueSlot::DoesNotNeedGCBarriers,
-                                AggValueSlot::IsNotAliased);
-      
-      CGF.EmitAggExpr(Init, Slot);
+    { // Scope for Cleanups.
+      CodeGenFunction::RunCleanupsScope Cleanups(CGF);
+
+      if (ArrayIndexVar) {
+        // If we have an array index variable, load it and use it as an offset.
+        // Then, increment the value.
+        llvm::Value *Dest = LHS.getAddress();
+        llvm::Value *ArrayIndex = CGF.Builder.CreateLoad(ArrayIndexVar);
+        Dest = CGF.Builder.CreateInBoundsGEP(Dest, ArrayIndex, "destaddress");
+        llvm::Value *Next = llvm::ConstantInt::get(ArrayIndex->getType(), 1);
+        Next = CGF.Builder.CreateAdd(ArrayIndex, Next, "inc");
+        CGF.Builder.CreateStore(Next, ArrayIndexVar);    
+
+        // Update the LValue.
+        LV.setAddress(Dest);
+        CharUnits Align = CGF.getContext().getTypeAlignInChars(T);
+        LV.setAlignment(std::min(Align, LV.getAlignment()));
+      }
+
+      if (!CGF.hasAggregateLLVMType(T)) {
+        CGF.EmitScalarInit(Init, /*decl*/ 0, LV, false);
+      } else if (T->isAnyComplexType()) {
+        CGF.EmitComplexExprIntoAddr(Init, LV.getAddress(),
+                                    LV.isVolatileQualified());
+      } else {
+        AggValueSlot Slot =
+          AggValueSlot::forLValue(LV,
+                                  AggValueSlot::IsDestructed,
+                                  AggValueSlot::DoesNotNeedGCBarriers,
+                                  AggValueSlot::IsNotAliased);
+
+        CGF.EmitAggExpr(Init, Slot);
+      }
     }
-    
+
+    // Now, outside of the initializer cleanup scope, destroy the backing array
+    // for a std::initializer_list member.
+    CGF.MaybeEmitStdInitializerListCleanup(LV.getAddress(), Init);
+
     return;
   }
   

Modified: cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp Tue Feb 21 15:38:41 2012
@@ -336,21 +336,19 @@
   case BuiltinType::Void:
     return llvm::DIType();
   case BuiltinType::ObjCClass:
-    return DBuilder.createStructType(TheCU, "objc_class", 
-                                     getOrCreateMainFile(), 0, 0, 0,
-                                     llvm::DIDescriptor::FlagFwdDecl, 
-                                     llvm::DIArray());
+    return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
+                                      "objc_class", getOrCreateMainFile(),
+                                      0);
   case BuiltinType::ObjCId: {
     // typedef struct objc_class *Class;
     // typedef struct objc_object {
     //  Class isa;
     // } *id;
 
-    llvm::DIType OCTy = 
-      DBuilder.createStructType(TheCU, "objc_class", 
-                                getOrCreateMainFile(), 0, 0, 0,
-                                llvm::DIDescriptor::FlagFwdDecl, 
-                                llvm::DIArray());
+    llvm::DIType OCTy =
+      DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
+                                 "objc_class", getOrCreateMainFile(),
+                                 0);
     unsigned Size = CGM.getContext().getTypeSize(CGM.getContext().VoidPtrTy);
     
     llvm::DIType ISATy = DBuilder.createPointerType(OCTy, Size);
@@ -368,10 +366,10 @@
                                      0, 0, 0, 0, Elements);
   }
   case BuiltinType::ObjCSel: {
-    return  DBuilder.createStructType(TheCU, "objc_selector", 
-                                      getOrCreateMainFile(), 0, 0, 0,
-                                      llvm::DIDescriptor::FlagFwdDecl, 
-                                      llvm::DIArray());
+    return
+      DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
+                                 "objc_selector", getOrCreateMainFile(),
+                                 0);
   }
   case BuiltinType::UChar:
   case BuiltinType::Char_U: Encoding = llvm::dwarf::DW_ATE_unsigned_char; break;
@@ -553,7 +551,9 @@
     RecordDecl *RD = RTy->getDecl();
     llvm::DIDescriptor FDContext =
       getContextDescriptor(cast<Decl>(RD->getDeclContext()));
-    return createRecordFwdDecl(RD, FDContext);
+    llvm::DIType RetTy = createRecordFwdDecl(RD, FDContext);
+    TypeCache[QualType(RTy, 0).getAsOpaquePtr()] = RetTy;
+    return RetTy;
   }
   return getOrCreateType(PointeeTy, Unit);
 
@@ -1120,7 +1120,6 @@
 llvm::DIType CGDebugInfo::getOrCreateRecordType(QualType RTy, 
                                                 SourceLocation Loc) {
   llvm::DIType T = getOrCreateType(RTy, getOrCreateFile(Loc));
-  DBuilder.retainType(T);
   return T;
 }
 
@@ -1224,10 +1223,9 @@
   ObjCInterfaceDecl *Def = ID->getDefinition();
   if (!Def) {
     llvm::DIType FwdDecl =
-      DBuilder.createStructType(Unit, ID->getName(),
-                                DefUnit, Line, 0, 0,
-                                llvm::DIDescriptor::FlagFwdDecl,
-                                llvm::DIArray(), RuntimeLang);
+      DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
+				 ID->getName(), DefUnit, Line,
+				 RuntimeLang);
     return FwdDecl;
   }
   ID = Def;
@@ -1770,7 +1768,7 @@
     // than C++ class type, but needs llvm metadata changes first.
     RealDecl = DBuilder.createClassType(RDContext, RDName, DefUnit, Line,
 					Size, Align, 0, 0, llvm::DIType(),
-					llvm::DIArray(), NULL,
+					llvm::DIArray(), llvm::DIType(),
 					llvm::DIArray());
   } else
     RealDecl = DBuilder.createStructType(RDContext, RDName, DefUnit, Line,
@@ -2580,8 +2578,9 @@
         RepTy = llvm::DIType(cast<llvm::MDNode>(it->second));
     }
     
-    if (Ty.Verify() && RepTy.Verify())
+    if (Ty.Verify() && Ty.isForwardDecl() && RepTy.Verify()) {
       Ty.replaceAllUsesWith(RepTy);
+    }
   }
   DBuilder.finalize();
 }

Modified: cfe/branches/tooling/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDecl.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDecl.cpp Tue Feb 21 15:38:41 2012
@@ -1093,7 +1093,7 @@
                                               AggValueSlot::IsDestructed,
                                          AggValueSlot::DoesNotNeedGCBarriers,
                                               AggValueSlot::IsNotAliased));
-    MaybeEmitStdInitializerListCleanup(lvalue, init);
+    MaybeEmitStdInitializerListCleanup(lvalue.getAddress(), init);
   }
 }
 

Modified: cfe/branches/tooling/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDeclCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDeclCXX.cpp Tue Feb 21 15:38:41 2012
@@ -103,7 +103,8 @@
 
 /// Emit code to cause the variable at the given address to be considered as
 /// constant from this point onwards.
-static void EmitDeclInvariant(CodeGenFunction &CGF, llvm::Constant *Addr) {
+static void EmitDeclInvariant(CodeGenFunction &CGF, const VarDecl &D,
+                              llvm::Constant *Addr) {
   // Don't emit the intrinsic if we're not optimizing.
   if (!CGF.CGM.getCodeGenOpts().OptimizationLevel)
     return;
@@ -112,8 +113,10 @@
   llvm::Intrinsic::ID InvStartID = llvm::Intrinsic::invariant_start;
   llvm::Constant *InvariantStart = CGF.CGM.getIntrinsic(InvStartID);
 
-  // Emit a call, with size -1 signifying the whole object.
-  llvm::Value *Args[2] = { llvm::ConstantInt::getSigned(CGF.Int64Ty, -1),
+  // Emit a call with the size in bytes of the object.
+  CharUnits WidthChars = CGF.getContext().getTypeSizeInChars(D.getType());
+  uint64_t Width = WidthChars.getQuantity();
+  llvm::Value *Args[2] = { llvm::ConstantInt::getSigned(CGF.Int64Ty, Width),
                            llvm::ConstantExpr::getBitCast(Addr, CGF.Int8PtrTy)};
   CGF.Builder.CreateCall(InvariantStart, Args);
 }
@@ -129,7 +132,7 @@
     if (PerformInit)
       EmitDeclInit(*this, D, DeclPtr);
     if (CGM.isTypeConstant(D.getType(), true))
-      EmitDeclInvariant(*this, DeclPtr);
+      EmitDeclInvariant(*this, D, DeclPtr);
     else
       EmitDeclDestroy(*this, D, DeclPtr);
     return;

Modified: cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp Tue Feb 21 15:38:41 2012
@@ -1263,19 +1263,17 @@
                        Alignment, isVolatile);
 }
 
-void CodeGenFunction::MaybeEmitStdInitializerListCleanup(LValue lvalue,
-                                                    const Expr *init) {
+void CodeGenFunction::MaybeEmitStdInitializerListCleanup(llvm::Value *loc,
+                                                         const Expr *init) {
   const ExprWithCleanups *cleanups = dyn_cast<ExprWithCleanups>(init);
-  if (!cleanups)
-    return; // Nothing interesting here.
-  init = cleanups->getSubExpr();
+  if (cleanups)
+    init = cleanups->getSubExpr();
 
   if (isa<InitListExpr>(init) &&
       cast<InitListExpr>(init)->initializesStdInitializerList()) {
     // We initialized this std::initializer_list with an initializer list.
     // A backing array was created. Push a cleanup for it.
-    EmitStdInitializerListCleanup(lvalue.getAddress(),
-                                  cast<InitListExpr>(init));
+    EmitStdInitializerListCleanup(loc, cast<InitListExpr>(init));
   }
 }
 

Modified: cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp Tue Feb 21 15:38:41 2012
@@ -762,6 +762,8 @@
                               AggValueSlot::DoesNotNeedGCBarriers,
                               AggValueSlot::IsNotAliased);
     CGF.EmitAggExpr(Init, Slot);
+
+    CGF.MaybeEmitStdInitializerListCleanup(NewPtr, Init);
   }
 }
 

Modified: cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp Tue Feb 21 15:38:41 2012
@@ -339,6 +339,11 @@
 }
                             
 bool ConstStructBuilder::Build(InitListExpr *ILE) {
+  if (ILE->initializesStdInitializerList()) {
+    CGM.ErrorUnsupported(ILE, "global std::initializer_list");
+    return false;
+  }
+
   RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl();
   const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
 

Modified: cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp Tue Feb 21 15:38:41 2012
@@ -5704,8 +5704,13 @@
                                                const ObjCIvarDecl *Ivar,
                                                unsigned CVRQualifiers) {
   ObjCInterfaceDecl *ID = ObjectTy->getAs<ObjCObjectType>()->getInterface();
+  llvm::Value *Offset = EmitIvarOffset(CGF, ID, Ivar);
+  if (llvm::LoadInst *LI = dyn_cast<llvm::LoadInst>(Offset))
+    LI->setMetadata(CGM.getModule().getMDKindID("invariant.load"), 
+                   llvm::MDNode::get(VMContext,
+                   ArrayRef<llvm::Value*>()));
   return EmitValueForIvarAtOffset(CGF, ID, BaseValue, Ivar, CVRQualifiers,
-                                  EmitIvarOffset(CGF, ID, Ivar));
+                                  Offset);
 }
 
 llvm::Value *CGObjCNonFragileABIMac::EmitIvarOffset(

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h Tue Feb 21 15:38:41 2012
@@ -1811,7 +1811,7 @@
   llvm::Value* EmitCXXTypeidExpr(const CXXTypeidExpr *E);
   llvm::Value *EmitDynamicCast(llvm::Value *V, const CXXDynamicCastExpr *DCE);
 
-  void MaybeEmitStdInitializerListCleanup(LValue lvalue, const Expr *init);
+  void MaybeEmitStdInitializerListCleanup(llvm::Value *loc, const Expr *init);
   void EmitStdInitializerListCleanup(llvm::Value *loc,
                                      const InitListExpr *init);
 

Modified: cfe/branches/tooling/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Driver.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Driver.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Driver.cpp Tue Feb 21 15:38:41 2012
@@ -960,14 +960,16 @@
       // Check that the file exists, if enabled.
       if (CheckInputsExist && memcmp(Value, "-", 2) != 0) {
         SmallString<64> Path(Value);
-        if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory))
-          if (llvm::sys::path::is_absolute(Path.str())) {
-            Path = WorkDir->getValue(Args);
-            llvm::sys::path::append(Path, Value);
+        if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory)) {
+          SmallString<64> Directory(WorkDir->getValue(Args));
+          if (llvm::sys::path::is_absolute(Directory.str())) {
+            llvm::sys::path::append(Directory, Value);
+            Path.assign(Directory);
           }
+        }
 
         bool exists = false;
-        if (/*error_code ec =*/llvm::sys::fs::exists(Value, exists) || !exists)
+        if (llvm::sys::fs::exists(Path.c_str(), exists) || !exists)
           Diag(clang::diag::err_drv_no_such_file) << Path.str();
         else
           Inputs.push_back(std::make_pair(Ty, A));

Modified: cfe/branches/tooling/lib/Frontend/ASTMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/ASTMerge.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/ASTMerge.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/ASTMerge.cpp Tue Feb 21 15:38:41 2012
@@ -37,10 +37,10 @@
                                          CI.getASTContext().getLangOptions());
   CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
                                        &CI.getASTContext());
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs>
+  IntrusiveRefCntPtr<DiagnosticIDs>
       DiagIDs(CI.getDiagnostics().getDiagnosticIDs());
   for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
-    llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+    IntrusiveRefCntPtr<DiagnosticsEngine>
         Diags(new DiagnosticsEngine(DiagIDs, CI.getDiagnostics().getClient(),
                              /*ShouldOwnClient=*/false));
     ASTUnit *Unit = ASTUnit::LoadFromASTFile(ASTFiles[I], Diags,

Modified: cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/ASTUnit.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/ASTUnit.cpp Tue Feb 21 15:38:41 2012
@@ -493,7 +493,7 @@
   ASTContext &Context;
   LangOptions &LangOpt;
   HeaderSearch &HSI;
-  llvm::IntrusiveRefCntPtr<TargetInfo> &Target;
+  IntrusiveRefCntPtr<TargetInfo> &Target;
   std::string &Predefines;
   unsigned &Counter;
 
@@ -503,7 +503,7 @@
 public:
   ASTInfoCollector(Preprocessor &PP, ASTContext &Context, LangOptions &LangOpt, 
                    HeaderSearch &HSI,
-                   llvm::IntrusiveRefCntPtr<TargetInfo> &Target,
+                   IntrusiveRefCntPtr<TargetInfo> &Target,
                    std::string &Predefines,
                    unsigned &Counter)
     : PP(PP), Context(Context), LangOpt(LangOpt), HSI(HSI), Target(Target),
@@ -630,7 +630,7 @@
 }
 
 /// \brief Configure the diagnostics object for use with ASTUnit.
-void ASTUnit::ConfigureDiags(llvm::IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
+void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
                              const char **ArgBegin, const char **ArgEnd,
                              ASTUnit &AST, bool CaptureDiagnostics) {
   if (!Diags.getPtr()) {
@@ -648,7 +648,7 @@
 }
 
 ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                   const FileSystemOptions &FileSystemOpts,
                                   bool OnlyLocalDecls,
                                   RemappedFile *RemappedFiles,
@@ -1031,7 +1031,7 @@
   llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance>
     CICleanup(Clang.get());
 
-  llvm::IntrusiveRefCntPtr<CompilerInvocation>
+  IntrusiveRefCntPtr<CompilerInvocation>
     CCInvocation(new CompilerInvocation(*Invocation));
 
   Clang->setInvocation(CCInvocation.getPtr());
@@ -1308,7 +1308,7 @@
                                                            bool AllowRebuild,
                                                            unsigned MaxLines) {
   
-  llvm::IntrusiveRefCntPtr<CompilerInvocation>
+  IntrusiveRefCntPtr<CompilerInvocation>
     PreambleInvocation(new CompilerInvocation(PreambleInvocationIn));
   FrontendOptions &FrontendOpts = PreambleInvocation->getFrontendOpts();
   PreprocessorOptions &PreprocessorOpts
@@ -1646,7 +1646,7 @@
 }
 
 ASTUnit *ASTUnit::create(CompilerInvocation *CI,
-                         llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                         IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                          bool CaptureDiagnostics) {
   OwningPtr<ASTUnit> AST;
   AST.reset(new ASTUnit(false));
@@ -1661,7 +1661,7 @@
 }
 
 ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                              ASTFrontendAction *Action,
                                              ASTUnit *Unit,
                                              bool Persistent,
@@ -1827,7 +1827,7 @@
 }
 
 ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI,
-                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                              IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                              bool OnlyLocalDecls,
                                              bool CaptureDiagnostics,
                                              bool PrecompilePreamble,
@@ -1858,7 +1858,7 @@
 
 ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
                                       const char **ArgEnd,
-                                    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+                                    IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                       StringRef ResourceFilesPath,
                                       bool OnlyLocalDecls,
                                       bool CaptureDiagnostics,
@@ -1879,7 +1879,7 @@
 
   SmallVector<StoredDiagnostic, 4> StoredDiagnostics;
   
-  llvm::IntrusiveRefCntPtr<CompilerInvocation> CI;
+  IntrusiveRefCntPtr<CompilerInvocation> CI;
 
   {
 
@@ -2252,7 +2252,7 @@
   CompletionTimer.setOutput("Code completion @ " + File + ":" +
                             Twine(Line) + ":" + Twine(Column));
 
-  llvm::IntrusiveRefCntPtr<CompilerInvocation>
+  IntrusiveRefCntPtr<CompilerInvocation>
     CCInvocation(new CompilerInvocation(*Invocation));
 
   FrontendOptions &FrontendOpts = CCInvocation->getFrontendOpts();

Modified: cfe/branches/tooling/lib/Frontend/ChainedIncludesSource.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/ChainedIncludesSource.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/ChainedIncludesSource.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/ChainedIncludesSource.cpp Tue Feb 21 15:38:41 2012
@@ -87,8 +87,8 @@
 
     TextDiagnosticPrinter *DiagClient =
       new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
-    llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+    IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+    IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
         new DiagnosticsEngine(DiagID, DiagClient));
 
     OwningPtr<CompilerInstance> Clang(new CompilerInstance());

Modified: cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp Tue Feb 21 15:38:41 2012
@@ -175,15 +175,15 @@
                                   &getCodeGenOpts());
 }
 
-llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+IntrusiveRefCntPtr<DiagnosticsEngine>
 CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
                                     int Argc, const char* const *Argv,
                                     DiagnosticConsumer *Client,
                                     bool ShouldOwnClient,
                                     bool ShouldCloneClient,
                                     const CodeGenOptions *CodeGenOpts) {
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine>
       Diags(new DiagnosticsEngine(DiagID));
 
   // Create the diagnostic client for reporting errors or for
@@ -734,7 +734,7 @@
     = ImportingInstance.getPreprocessor().getHeaderSearchInfo().getModuleMap();
     
   // Construct a compiler invocation for creating this module.
-  llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation
+  IntrusiveRefCntPtr<CompilerInvocation> Invocation
     (new CompilerInvocation(ImportingInstance.getInvocation()));
 
   PreprocessorOptions &PPOpts = Invocation->getPreprocessorOpts();

Modified: cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp Tue Feb 21 15:38:41 2012
@@ -38,7 +38,7 @@
   : LangOpts(new LangOptions()) {}
 
 CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X)
-  : llvm::RefCountedBase<CompilerInvocation>(),
+  : RefCountedBase<CompilerInvocation>(),
     LangOpts(new LangOptions(*X.getLangOpts())) {}
 
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp Tue Feb 21 15:38:41 2012
@@ -30,7 +30,7 @@
 /// argument vector.
 CompilerInvocation *
 clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,
-                            llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
+                            IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
   if (!Diags.getPtr()) {
     // No diagnostics engine was provided, so create our own diagnostics object
     // with the default options.

Modified: cfe/branches/tooling/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/FrontendAction.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/FrontendAction.cpp Tue Feb 21 15:38:41 2012
@@ -173,7 +173,7 @@
     assert(hasASTFileSupport() &&
            "This action does not have AST file support!");
 
-    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
+    IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
     std::string Error;
     ASTUnit *AST = ASTUnit::LoadFromASTFile(Input.File, Diags,
                                             CI.getFileSystemOpts());

Modified: cfe/branches/tooling/lib/Frontend/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/Warnings.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/Warnings.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/Warnings.cpp Tue Feb 21 15:38:41 2012
@@ -73,7 +73,7 @@
     Diags.setExtensionHandlingBehavior(DiagnosticsEngine::Ext_Ignore);
 
   llvm::SmallVector<diag::kind, 10> _Diags;
-  const llvm::IntrusiveRefCntPtr< DiagnosticIDs > DiagIDs =
+  const IntrusiveRefCntPtr< DiagnosticIDs > DiagIDs =
     Diags.getDiagnosticIDs();
   // We parse the warning options twice.  The first pass sets diagnostic state,
   // while the second pass reports warnings/errors.  This has the effect that

Modified: cfe/branches/tooling/lib/Headers/unwind.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Headers/unwind.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Headers/unwind.h (original)
+++ cfe/branches/tooling/lib/Headers/unwind.h Tue Feb 21 15:38:41 2012
@@ -23,9 +23,19 @@
 
 /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
 
-#if defined(__APPLE__) && __has_include_next(<unwind.h>)
-/* Darwin typically has its own unwind.h; use it. */
-#  include_next <unwind.h>
+#if __has_include_next(<unwind.h>)
+/* Darwin and libunwind provide an unwind.h. If that's available, use
+ * it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+ * so define that around the include.*/
+# ifndef _GNU_SOURCE
+#  define _SHOULD_UNDEFINE_GNU_SOURCE
+#  define _GNU_SOURCE
+# endif
+# include_next <unwind.h>
+# ifdef _SHOULD_UNDEFINE_GNU_SOURCE
+#  undef _GNU_SOURCE
+#  undef _SHOULD_UNDEFINE_GNU_SOURCE
+# endif
 #else
 
 #include <stdint.h>

Modified: cfe/branches/tooling/lib/Headers/x86intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Headers/x86intrin.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Headers/x86intrin.h (original)
+++ cfe/branches/tooling/lib/Headers/x86intrin.h Tue Feb 21 15:38:41 2012
@@ -26,6 +26,10 @@
 
 #include <immintrin.h>
 
+#ifdef __3dNOW__
+#include <mm3dnow.h>
+#endif
+
 #ifdef __BMI__
 #include <bmiintrin.h>
 #endif
@@ -46,6 +50,6 @@
 #include <fma4intrin.h>
 #endif
 
-// FIXME: SSE4A, 3dNOW, XOP, LWP, ABM
+// FIXME: SSE4A, XOP, LWP, ABM
 
 #endif /* __X86INTRIN_H */

Modified: cfe/branches/tooling/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/ModuleMap.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/ModuleMap.cpp (original)
+++ cfe/branches/tooling/lib/Lex/ModuleMap.cpp Tue Feb 21 15:38:41 2012
@@ -73,8 +73,8 @@
                      const LangOptions &LangOpts, const TargetInfo *Target)
   : LangOpts(LangOpts), Target(Target), BuiltinIncludeDir(0)
 {
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(new DiagnosticIDs);
-  Diags = llvm::IntrusiveRefCntPtr<DiagnosticsEngine>(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(new DiagnosticIDs);
+  Diags = IntrusiveRefCntPtr<DiagnosticsEngine>(
             new DiagnosticsEngine(DiagIDs));
   Diags->setClient(DC.clone(*Diags), /*ShouldOwnClient=*/true);
   SourceMgr = new SourceManager(*Diags, FileMgr);

Modified: cfe/branches/tooling/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseCXXInlineMethods.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseCXXInlineMethods.cpp Tue Feb 21 15:38:41 2012
@@ -297,7 +297,8 @@
                             Scope::FunctionPrototypeScope|Scope::DeclScope);
   for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
     // Introduce the parameter into scope.
-    Actions.ActOnDelayedCXXMethodParameter(getCurScope(), LM.DefaultArgs[I].Param);
+    Actions.ActOnDelayedCXXMethodParameter(getCurScope(), 
+                                           LM.DefaultArgs[I].Param);
 
     if (CachedTokens *Toks = LM.DefaultArgs[I].Toks) {
       // Save the current token position.
@@ -317,7 +318,8 @@
       // The argument isn't actually potentially evaluated unless it is
       // used.
       EnterExpressionEvaluationContext Eval(Actions,
-                                            Sema::PotentiallyEvaluatedIfUsed);
+                                            Sema::PotentiallyEvaluatedIfUsed,
+                                            LM.DefaultArgs[I].Param);
 
       ExprResult DefArgResult(ParseAssignmentExpression());
       if (DefArgResult.isInvalid())
@@ -476,7 +478,8 @@
   ConsumeAnyToken();
 
   SourceLocation EqualLoc;
-  ExprResult Init = ParseCXXMemberInitializer(/*IsFunction=*/false, EqualLoc);
+  ExprResult Init = ParseCXXMemberInitializer(MI.Field, /*IsFunction=*/false, 
+                                              EqualLoc);
 
   Actions.ActOnCXXInClassMemberInitializer(MI.Field, EqualLoc, Init.release());
 

Modified: cfe/branches/tooling/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDecl.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDecl.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDecl.cpp Tue Feb 21 15:38:41 2012
@@ -4520,7 +4520,8 @@
           // The argument isn't actually potentially evaluated unless it is 
           // used.
           EnterExpressionEvaluationContext Eval(Actions,
-                                              Sema::PotentiallyEvaluatedIfUsed);
+                                              Sema::PotentiallyEvaluatedIfUsed,
+                                                Param);
 
           ExprResult DefArgResult(ParseAssignmentExpression());
           if (DefArgResult.isInvalid()) {

Modified: cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp Tue Feb 21 15:38:41 2012
@@ -2000,7 +2000,7 @@
     } else if (HasInitializer) {
       // Normal initializer.
       if (!Init.isUsable())
-        Init = ParseCXXMemberInitializer(
+        Init = ParseCXXMemberInitializer(ThisDecl,
                  DeclaratorInfo.isDeclarationOfFunction(), EqualLoc);
       
       if (Init.isInvalid())
@@ -2096,11 +2096,14 @@
 ///
 /// Prior to C++0x, the assignment-expression in an initializer-clause must
 /// be a constant-expression.
-ExprResult Parser::ParseCXXMemberInitializer(bool IsFunction,
+ExprResult Parser::ParseCXXMemberInitializer(Decl *D, bool IsFunction,
                                              SourceLocation &EqualLoc) {
   assert((Tok.is(tok::equal) || Tok.is(tok::l_brace))
          && "Data member initializer not starting with '=' or '{'");
 
+  EnterExpressionEvaluationContext Context(Actions, 
+                                           Sema::PotentiallyEvaluated,
+                                           D);
   if (Tok.is(tok::equal)) {
     EqualLoc = ConsumeToken();
     if (Tok.is(tok::kw_delete)) {

Modified: cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp Tue Feb 21 15:38:41 2012
@@ -886,8 +886,7 @@
   BodyScope.Exit();
 
   if (!Stmt.isInvalid())
-    return Actions.ActOnLambdaExpr(LambdaBeginLoc, Stmt.take(),
-                                   getCurScope());
+    return Actions.ActOnLambdaExpr(LambdaBeginLoc, Stmt.take(), getCurScope());
  
   Actions.ActOnLambdaError(LambdaBeginLoc, getCurScope());
   return ExprError();
@@ -1714,6 +1713,7 @@
     }
 
     TemplateId->SS = SS;
+    TemplateId->TemplateKWLoc = TemplateKWLoc;
     TemplateId->Template = Template;
     TemplateId->Kind = TNK;
     TemplateId->LAngleLoc = LAngleLoc;

Modified: cfe/branches/tooling/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseStmt.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseStmt.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseStmt.cpp Tue Feb 21 15:38:41 2012
@@ -1396,8 +1396,7 @@
         return StmtError();
       }
       Collection = ParseExpression();
-    } else if (getLang().CPlusPlus0x && Tok.is(tok::colon) &&
-               !FirstPart.isInvalid()) {
+    } else if (getLang().CPlusPlus0x && Tok.is(tok::colon) && FirstPart.get()) {
       // User tried to write the reasonable, but ill-formed, for-range-statement
       //   for (expr : expr) { ... }
       Diag(Tok, diag::err_for_range_expected_decl)

Modified: cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp Tue Feb 21 15:38:41 2012
@@ -934,7 +934,17 @@
 
   // FIXME: handle category headers that are declared across multiple lines.
   ReplaceText(LocStart, 0, "// ");
-
+  if (CatDecl->getIvarLBraceLoc().isValid())
+    InsertText(CatDecl->getIvarLBraceLoc(), "// ");
+  for (ObjCCategoryDecl::ivar_iterator
+       I = CatDecl->ivar_begin(), E = CatDecl->ivar_end(); I != E; ++I) {
+    ObjCIvarDecl *Ivar = (*I);
+    SourceLocation LocStart = Ivar->getLocStart();
+    ReplaceText(LocStart, 0, "// ");
+  } 
+  if (CatDecl->getIvarRBraceLoc().isValid())
+    InsertText(CatDecl->getIvarRBraceLoc(), "// ");
+  
   for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
        E = CatDecl->prop_end(); I != E; ++I)
     RewriteProperty(*I);
@@ -1144,7 +1154,21 @@
   ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OID);
   ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(OID);
 
-  InsertText(IMD ? IMD->getLocStart() : CID->getLocStart(), "// ");
+  if (IMD) {
+    InsertText(IMD->getLocStart(), "// ");
+    if (IMD->getIvarLBraceLoc().isValid())
+      InsertText(IMD->getIvarLBraceLoc(), "// ");
+    for (ObjCImplementationDecl::ivar_iterator
+         I = IMD->ivar_begin(), E = IMD->ivar_end(); I != E; ++I) {
+      ObjCIvarDecl *Ivar = (*I);
+      SourceLocation LocStart = Ivar->getLocStart();
+      ReplaceText(LocStart, 0, "// ");
+    }
+    if (IMD->getIvarRBraceLoc().isValid())
+      InsertText(IMD->getIvarRBraceLoc(), "// ");
+  }
+  else
+    InsertText(CID->getLocStart(), "// ");
 
   for (ObjCCategoryImplDecl::instmeth_iterator
        I = IMD ? IMD->instmeth_begin() : CID->instmeth_begin(),

Modified: cfe/branches/tooling/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/Sema.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/Sema.cpp (original)
+++ cfe/branches/tooling/lib/Sema/Sema.cpp Tue Feb 21 15:38:41 2012
@@ -111,7 +111,7 @@
                                        &Context);
 
   ExprEvalContexts.push_back(
-        ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0, false));
+        ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0, false, 0));
 
   FunctionScopes.push_back(new FunctionScopeInfo(Diags));
 }

Modified: cfe/branches/tooling/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaChecking.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaChecking.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaChecking.cpp Tue Feb 21 15:38:41 2012
@@ -1447,13 +1447,27 @@
       //      vprintf(fmt, ap);  // Do NOT emit a warning about "fmt".
       //      ...
       //
-      //
-      //  FIXME: We don't have full attribute support yet, so just check to see
-      //    if the argument is a DeclRefExpr that references a parameter.  We'll
-      //    add proper support for checking the attribute later.
-      if (HasVAListArg)
-        if (isa<ParmVarDecl>(VD))
-          return true;
+      if (HasVAListArg) {
+        if (const ParmVarDecl *PV = dyn_cast<ParmVarDecl>(VD)) {
+          if (const NamedDecl *ND = dyn_cast<NamedDecl>(PV->getDeclContext())) {
+            int PVIndex = PV->getFunctionScopeIndex() + 1;
+            for (specific_attr_iterator<FormatAttr>
+                 i = ND->specific_attr_begin<FormatAttr>(),
+                 e = ND->specific_attr_end<FormatAttr>(); i != e ; ++i) {
+              FormatAttr *PVFormat = *i;
+              // adjust for implicit parameter
+              if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(ND))
+                if (MD->isInstance())
+                  ++PVIndex;
+              // We also check if the formats are compatible.
+              // We can't pass a 'scanf' string to a 'printf' function.
+              if (PVIndex == PVFormat->getFormatIdx() &&
+                  Type == GetFormatStringType(PVFormat))
+                return true;
+            }
+          }
+        }
+      }
     }
 
     return false;

Modified: cfe/branches/tooling/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDecl.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDecl.cpp Tue Feb 21 15:38:41 2012
@@ -6101,7 +6101,8 @@
     }
     VDecl->setTypeSourceInfo(DeducedType);
     VDecl->setType(DeducedType->getType());
-
+    VDecl->ClearLinkageCache();
+    
     // In ARC, infer lifetime.
     if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(VDecl))
       VDecl->setInvalidDecl();
@@ -9584,6 +9585,8 @@
         // Only it is in implementation's lexical context.
         ClsFields[I]->setLexicalDeclContext(IMPDecl);
       CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac);
+      IMPDecl->setIvarLBraceLoc(LBrac);
+      IMPDecl->setIvarRBraceLoc(RBrac);
     } else if (ObjCCategoryDecl *CDecl = 
                 dyn_cast<ObjCCategoryDecl>(EnclosingDecl)) {
       // case of ivars in class extension; all other cases have been
@@ -9617,6 +9620,8 @@
         ClsFields[i]->setLexicalDeclContext(CDecl);
         CDecl->addDecl(ClsFields[i]);
       }
+      CDecl->setIvarLBraceLoc(LBrac);
+      CDecl->setIvarRBraceLoc(RBrac);
     }
   }
 

Modified: cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp Tue Feb 21 15:38:41 2012
@@ -516,13 +516,9 @@
     }
   }
 
-  // C++0x [dcl.constexpr]p1: If any declaration of a function or function
+  // C++11 [dcl.constexpr]p1: If any declaration of a function or function
   // template has a constexpr specifier then all its declarations shall
-  // contain the constexpr specifier. [Note: An explicit specialization can
-  // differ from the template declaration with respect to the constexpr
-  // specifier. -- end note]
-  //
-  // FIXME: Don't reject changes in constexpr in explicit specializations.
+  // contain the constexpr specifier.
   if (New->isConstexpr() != Old->isConstexpr()) {
     Diag(New->getLocation(), diag::err_constexpr_redecl_mismatch)
       << New << New->isConstexpr();
@@ -1643,6 +1639,10 @@
 
   ExprResult Init = InitExpr;
   if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
+    if (isa<InitListExpr>(InitExpr) && isStdInitializerList(FD->getType(), 0)) {
+    Diag(FD->getLocation(), diag::warn_dangling_std_initializer_list)
+        << /*at end of ctor*/1 << InitExpr->getSourceRange();
+    }
     // FIXME: if there is no EqualLoc, this is list-initialization.
     Init = PerformCopyInitialization(
       InitializedEntity::InitializeMember(FD), EqualLoc, InitExpr);
@@ -2112,6 +2112,11 @@
       InitList = true;
       Args = &Init;
       NumArgs = 1;
+
+      if (isStdInitializerList(Member->getType(), 0)) {
+        Diag(IdLoc, diag::warn_dangling_std_initializer_list)
+            << /*at end of ctor*/1 << InitRange;
+      }
     }
 
     // Initialize the member.
@@ -10389,6 +10394,14 @@
   return true;
 }
 
+/// \brief Determine whether the given declaration is a static data member.
+static bool isStaticDataMember(Decl *D) {
+  VarDecl *Var = dyn_cast_or_null<VarDecl>(D);
+  if (!Var)
+    return false;
+  
+  return Var->isStaticDataMember();
+}
 /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse
 /// an initializer for the out-of-line declaration 'Dcl'.  The scope
 /// is a fresh scope pushed for just this purpose.
@@ -10404,6 +10417,12 @@
   //   int foo::bar;
   assert(D->isOutOfLine());
   EnterDeclaratorContext(S, D->getDeclContext());
+  
+  // If we are parsing the initializer for a static data member, push a
+  // new expression evaluation context that is associated with this static
+  // data member.
+  if (isStaticDataMember(D))
+    PushExpressionEvaluationContext(PotentiallyEvaluated, D);
 }
 
 /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
@@ -10412,6 +10431,9 @@
   // If there is no declaration, there was an error parsing it.
   if (D == 0 || D->isInvalidDecl()) return;
 
+  if (isStaticDataMember(D))
+    PopExpressionEvaluationContext();  
+
   assert(D->isOutOfLine());
   ExitDeclaratorContext(S);
 }

Modified: cfe/branches/tooling/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExpr.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExpr.cpp Tue Feb 21 15:38:41 2012
@@ -3146,7 +3146,8 @@
   // We already type-checked the argument, so we know it works. 
   // Just mark all of the declarations in this potentially-evaluated expression
   // as being "referenced".
-  MarkDeclarationsReferencedInExpr(Param->getDefaultArg());
+  MarkDeclarationsReferencedInExpr(Param->getDefaultArg(),
+                                   /*SkipLocalVariables=*/true);
   return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param));
 }
 
@@ -9275,11 +9276,13 @@
 }
 
 void
-Sema::PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext) {
+Sema::PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext,
+                                      Decl *LambdaContextDecl) {
   ExprEvalContexts.push_back(
              ExpressionEvaluationContextRecord(NewContext,
                                                ExprCleanupObjects.size(),
-                                               ExprNeedsCleanups));
+                                               ExprNeedsCleanups,
+                                               LambdaContextDecl));
   ExprNeedsCleanups = false;
   if (!MaybeODRUseExprs.empty())
     std::swap(MaybeODRUseExprs, ExprEvalContexts.back().SavedMaybeODRUseExprs);
@@ -10143,13 +10146,22 @@
   /// potentially-evaluated subexpressions as "referenced".
   class EvaluatedExprMarker : public EvaluatedExprVisitor<EvaluatedExprMarker> {
     Sema &S;
+    bool SkipLocalVariables;
     
   public:
     typedef EvaluatedExprVisitor<EvaluatedExprMarker> Inherited;
     
-    explicit EvaluatedExprMarker(Sema &S) : Inherited(S.Context), S(S) { }
+    EvaluatedExprMarker(Sema &S, bool SkipLocalVariables) 
+      : Inherited(S.Context), S(S), SkipLocalVariables(SkipLocalVariables) { }
     
     void VisitDeclRefExpr(DeclRefExpr *E) {
+      // If we were asked not to visit local variables, don't.
+      if (SkipLocalVariables) {
+        if (VarDecl *VD = dyn_cast<VarDecl>(E->getDecl()))
+          if (VD->hasLocalStorage())
+            return;
+      }
+      
       S.MarkDeclRefReferenced(E);
     }
     
@@ -10191,6 +10203,10 @@
     }
     
     void VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
+      // If we were asked not to visit local variables, don't.
+      if (SkipLocalVariables && E->getDecl()->hasLocalStorage())
+          return;
+
       S.MarkBlockDeclRefReferenced(E);
     }
     
@@ -10209,8 +10225,12 @@
 
 /// \brief Mark any declarations that appear within this expression or any
 /// potentially-evaluated subexpressions as "referenced".
-void Sema::MarkDeclarationsReferencedInExpr(Expr *E) {
-  EvaluatedExprMarker(*this).Visit(E);
+///
+/// \param SkipLocalVariables If true, don't mark local variables as 
+/// 'referenced'.
+void Sema::MarkDeclarationsReferencedInExpr(Expr *E, 
+                                            bool SkipLocalVariables) {
+  EvaluatedExprMarker(*this, SkipLocalVariables).Visit(E);
 }
 
 /// \brief Emit a diagnostic that describes an effect on the run-time behavior

Modified: cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp Tue Feb 21 15:38:41 2012
@@ -1087,7 +1087,7 @@
   if (initStyle == CXXNewExpr::ListInit && isStdInitializerList(AllocType, 0)) {
     Diag(AllocTypeInfo->getTypeLoc().getBeginLoc(),
          diag::warn_dangling_std_initializer_list)
-      << /*at end of FE*/0 << Inits[0]->getSourceRange();
+        << /*at end of FE*/0 << Inits[0]->getSourceRange();
   }
 
   // In ARC, infer 'retaining' for the allocated 

Modified: cfe/branches/tooling/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaLambda.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaLambda.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaLambda.cpp Tue Feb 21 15:38:41 2012
@@ -13,6 +13,7 @@
 #include "clang/Sema/DeclSpec.h"
 #include "clang/Sema/Initialization.h"
 #include "clang/Sema/Lookup.h"
+#include "clang/Sema/Scope.h"
 #include "clang/Sema/ScopeInfo.h"
 #include "clang/Sema/SemaInternal.h"
 #include "clang/Lex/Preprocessor.h"
@@ -20,15 +21,17 @@
 using namespace clang;
 using namespace sema;
 
-CXXRecordDecl *Sema::createLambdaClosureType(SourceRange IntroducerRange) {
+CXXRecordDecl *Sema::createLambdaClosureType(SourceRange IntroducerRange,
+                                             bool KnownDependent) {
   DeclContext *DC = CurContext;
   while (!(DC->isFunctionOrMethod() || DC->isRecord() || DC->isFileContext()))
     DC = DC->getParent();
   
   // Start constructing the lambda class.
   CXXRecordDecl *Class = CXXRecordDecl::CreateLambda(Context, DC, 
-                                                     IntroducerRange.getBegin());
-  CurContext->addDecl(Class);
+                                                     IntroducerRange.getBegin(),
+                                                     KnownDependent);
+  DC->addDecl(Class);
   
   return Class;
 }
@@ -65,7 +68,7 @@
   
   // Temporarily set the lexical declaration context to the current
   // context, so that the Scope stack matches the lexical nesting.
-  Method->setLexicalDeclContext(Class->getDeclContext());  
+  Method->setLexicalDeclContext(CurContext);  
   
   // Add parameters.
   if (!Params.empty()) {
@@ -141,7 +144,14 @@
 void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
                                         Declarator &ParamInfo,
                                         Scope *CurScope) {
-  CXXRecordDecl *Class = createLambdaClosureType(Intro.Range);
+  // Determine if we're within a context where we know that the lambda will
+  // be dependent, because there are template parameters in scope.
+  bool KnownDependent = false;
+  if (Scope *TmplScope = CurScope->getTemplateParamParent())
+    if (!TmplScope->decl_empty())
+      KnownDependent = true;
+  
+  CXXRecordDecl *Class = createLambdaClosureType(Intro.Range, KnownDependent);
   
   // Determine the signature of the call operator.
   TypeSourceInfo *MethodTyInfo;
@@ -482,12 +492,25 @@
   Class->addDecl(Conversion);
 }
 
+/// \brief Determine whether the given context is or is enclosed in an inline
+/// function.
+static bool isInInlineFunction(const DeclContext *DC) {
+  while (!DC->isFileContext()) {
+    if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(DC))
+      if (FD->isInlined())
+        return true;
+    
+    DC = DC->getLexicalParent();
+  }
+  
+  return false;
+}
+         
 ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, 
-                                 Scope *CurScope, bool IsInstantiation) {
-  // Leave the expression-evaluation context.
-  DiscardCleanupsInEvaluationContext();
-  PopExpressionEvaluationContext();
-
+                                 Scope *CurScope, 
+                                 llvm::Optional<unsigned> ManglingNumber,
+                                 Decl *ContextDecl,
+                                 bool IsInstantiation) {
   // Collect information from the lambda scope.
   llvm::SmallVector<LambdaExpr::Capture, 4> Captures;
   llvm::SmallVector<Expr *, 4> CaptureInits;
@@ -604,6 +627,7 @@
     ActOnFinishFunctionBody(CallOperator, Body, IsInstantiation);
     CallOperator->setLexicalDeclContext(Class);
     Class->addDecl(CallOperator);
+    PopExpressionEvaluationContext();
 
     // C++11 [expr.prim.lambda]p6:
     //   The closure type for a lambda-expression with no lambda-capture
@@ -627,17 +651,73 @@
     ActOnFields(0, Class->getLocation(), Class, Fields, 
                 SourceLocation(), SourceLocation(), 0);
     CheckCompletedCXXClass(Class);
-
   }
 
   if (LambdaExprNeedsCleanups)
     ExprNeedsCleanups = true;
 
+  // If we don't already have a mangling number for this lambda expression,
+  // allocate one now.
+  if (!ManglingNumber) {
+    ContextDecl = ExprEvalContexts.back().LambdaContextDecl;
+    
+    enum ContextKind {
+      Normal,
+      DefaultArgument,
+      DataMember,
+      StaticDataMember
+    } Kind = Normal;
+
+    // Default arguments of member function parameters that appear in a class
+    // definition, as well as the initializers of data members, receive special
+    // treatment. Identify them.
+    if (ContextDecl) {
+      if (ParmVarDecl *Param = dyn_cast<ParmVarDecl>(ContextDecl)) {
+        if (const DeclContext *LexicalDC
+              = Param->getDeclContext()->getLexicalParent())
+          if (LexicalDC->isRecord())
+            Kind = DefaultArgument;
+      } else if (VarDecl *Var = dyn_cast<VarDecl>(ContextDecl)) {
+        if (Var->getDeclContext()->isRecord())
+          Kind = StaticDataMember;
+      } else if (isa<FieldDecl>(ContextDecl)) {
+        Kind = DataMember;
+      }
+    }        
+    
+    switch (Kind) {
+    case Normal:
+      if (CurContext->isDependentContext() || isInInlineFunction(CurContext))
+        ManglingNumber = Context.getLambdaManglingNumber(CallOperator);
+      else
+        ManglingNumber = 0;
+        
+      // There is no special context for this lambda.
+      ContextDecl = 0;        
+      break;
+      
+    case StaticDataMember:
+      if (!CurContext->isDependentContext()) {
+        ManglingNumber = 0;
+        ContextDecl = 0;
+        break;
+      }
+      // Fall through to assign a mangling number.
+        
+    case DataMember:
+    case DefaultArgument:
+      ManglingNumber = ExprEvalContexts.back().getLambdaMangleContext()
+                         .getManglingNumber(CallOperator);
+      break;
+    }
+  }
+  
   LambdaExpr *Lambda = LambdaExpr::Create(Context, Class, IntroducerRange, 
                                           CaptureDefault, Captures, 
                                           ExplicitParams, ExplicitResultType,
                                           CaptureInits, ArrayIndexVars, 
-                                          ArrayIndexStarts, Body->getLocEnd());
+                                          ArrayIndexStarts, Body->getLocEnd(),
+                                          *ManglingNumber, ContextDecl);
 
   // C++11 [expr.prim.lambda]p2:
   //   A lambda-expression shall not appear in an unevaluated operand

Modified: cfe/branches/tooling/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaTemplate.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaTemplate.cpp Tue Feb 21 15:38:41 2012
@@ -5677,8 +5677,13 @@
   // Note: do not overwrite location info if previous template
   // specialization kind was explicit.
   TemplateSpecializationKind TSK = SpecInfo->getTemplateSpecializationKind();
-  if (TSK == TSK_Undeclared || TSK == TSK_ImplicitInstantiation)
+  if (TSK == TSK_Undeclared || TSK == TSK_ImplicitInstantiation) {
     Specialization->setLocation(FD->getLocation());
+    // C++11 [dcl.constexpr]p1: An explicit specialization of a constexpr
+    // function can differ from the template declaration with respect to
+    // the constexpr specifier.
+    Specialization->setConstexpr(FD->isConstexpr());
+  }
 
   // FIXME: Check if the prior specialization has a point of instantiation.
   // If so, we have run afoul of .

Modified: cfe/branches/tooling/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaType.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaType.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaType.cpp Tue Feb 21 15:38:41 2012
@@ -4249,7 +4249,9 @@
                               const PartialDiagnostic &PD) {
   assert(!T->isDependentType() && "type should not be dependent");
 
-  RequireCompleteType(Loc, T, 0);
+  QualType ElemType = Context.getBaseElementType(T);
+  RequireCompleteType(Loc, ElemType, 0);
+
   if (T->isLiteralType())
     return false;
 
@@ -4261,12 +4263,16 @@
   if (T->isVariableArrayType())
     return true;
 
-  const RecordType *RT = T->getBaseElementTypeUnsafe()->getAs<RecordType>();
+  const RecordType *RT = ElemType->getAs<RecordType>();
   if (!RT)
     return true;
 
   const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
 
+  // FIXME: Better diagnostic for incomplete class?
+  if (!RD->isCompleteDefinition())
+    return true;
+
   // If the class has virtual base classes, then it's not an aggregate, and
   // cannot have any constexpr constructors or a trivial default constructor,
   // so is non-literal. This is better to diagnose than the resulting absence

Modified: cfe/branches/tooling/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/TreeTransform.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/TreeTransform.h (original)
+++ cfe/branches/tooling/lib/Sema/TreeTransform.h Tue Feb 21 15:38:41 2012
@@ -7768,9 +7768,14 @@
                                /*IsInstantiation=*/true);
     return ExprError();    
   }
-  
+
+  // Note: Once a lambda mangling number and context declaration have been
+  // assigned, they never change.
+  unsigned ManglingNumber = E->getLambdaClass()->getLambdaManglingNumber();
+  Decl *ContextDecl = E->getLambdaClass()->getLambdaContextDecl();
   return getSema().ActOnLambdaExpr(E->getLocStart(), Body.take(), 
-                                   /*CurScope=*/0, 
+                                   /*CurScope=*/0, ManglingNumber,
+                                   ContextDecl,
                                    /*IsInstantiation=*/true);
 }
 

Modified: cfe/branches/tooling/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReader.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReader.cpp Tue Feb 21 15:38:41 2012
@@ -1111,6 +1111,10 @@
       return Failure;
     }
 
+    // We will detect whether a file changed and return 'Failure' for it, but
+    // we will also try to fail gracefully by setting up the SLocEntry.
+    ASTReader::ASTReadResult Result = Success;
+
     bool OverriddenBuffer = Record[6];
     
     std::string OrigFilename(BlobStart, BlobStart + BlobLen);
@@ -1149,7 +1153,7 @@
 #endif
         )) {
       Error(diag::err_fe_pch_file_modified, Filename);
-      return Failure;
+      Result = Failure;
     }
 
     SourceLocation IncludeLoc = ReadSourceLocation(*F, Record[1]);
@@ -1193,6 +1197,9 @@
                                            Filename);
       SourceMgr.overrideFileContents(File, Buffer);
     }
+
+    if (Result == Failure)
+      return Failure;
     break;
   }
 

Modified: cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp Tue Feb 21 15:38:41 2012
@@ -770,6 +770,8 @@
 void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
   VisitObjCContainerDecl(CD);
   CD->setCategoryNameLoc(ReadSourceLocation(Record, Idx));
+  CD->setIvarLBraceLoc(ReadSourceLocation(Record, Idx));
+  CD->setIvarRBraceLoc(ReadSourceLocation(Record, Idx));
   
   // Note that this category has been deserialized. We do this before
   // deserializing the interface declaration, so that it will consider this
@@ -829,6 +831,8 @@
 void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
   VisitObjCImplDecl(D);
   D->setSuperClass(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
+  D->setIvarLBraceLoc(ReadSourceLocation(Record, Idx));
+  D->setIvarRBraceLoc(ReadSourceLocation(Record, Idx));
   llvm::tie(D->IvarInitializers, D->NumIvarInitializers)
       = Reader.ReadCXXCtorInitializers(F, Record, Idx);
   D->setHasSynthBitfield(Record[Idx++]);
@@ -1103,8 +1107,11 @@
     typedef LambdaExpr::Capture Capture;
     CXXRecordDecl::LambdaDefinitionData &Lambda
       = static_cast<CXXRecordDecl::LambdaDefinitionData &>(Data);
+    Lambda.Dependent = Record[Idx++];
     Lambda.NumCaptures = Record[Idx++];
     Lambda.NumExplicitCaptures = Record[Idx++];
+    Lambda.ManglingNumber = Record[Idx++];
+    Lambda.ContextDecl = ReadDecl(Record, Idx);
     Lambda.Captures 
       = (Capture*)Reader.Context.Allocate(sizeof(Capture)*Lambda.NumCaptures);
     Capture *ToCapture = Lambda.Captures;
@@ -1128,7 +1135,7 @@
     // allocate the appropriate DefinitionData structure.
     bool IsLambda = Record[Idx++];
     if (IsLambda)
-      D->DefinitionData = new (C) CXXRecordDecl::LambdaDefinitionData(D);
+      D->DefinitionData = new (C) CXXRecordDecl::LambdaDefinitionData(D, false);
     else
       D->DefinitionData = new (C) struct CXXRecordDecl::DefinitionData(D);
     

Modified: cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp Tue Feb 21 15:38:41 2012
@@ -1174,14 +1174,9 @@
   E->setOperatorNew(ReadDeclAs<FunctionDecl>(Record, Idx));
   E->setOperatorDelete(ReadDeclAs<FunctionDecl>(Record, Idx));
   E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx);
-  SourceRange TypeIdParens;
-  TypeIdParens.setBegin(ReadSourceLocation(Record, Idx));
-  TypeIdParens.setEnd(ReadSourceLocation(Record, Idx));
-  E->TypeIdParens = TypeIdParens;
+  E->TypeIdParens = ReadSourceRange(Record, Idx);
   E->StartLoc = ReadSourceLocation(Record, Idx);
-  SourceRange DirectInitRange;
-  DirectInitRange.setBegin(ReadSourceLocation(Record, Idx));
-  DirectInitRange.setEnd(ReadSourceLocation(Record, Idx));
+  E->DirectInitRange = ReadSourceRange(Record, Idx);
 
   E->AllocateArgsArray(Reader.getContext(), isArray, NumPlacementArgs,
                        E->StoredInitializationStyle != 0);

Modified: cfe/branches/tooling/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTWriter.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTWriter.cpp Tue Feb 21 15:38:41 2012
@@ -4330,8 +4330,11 @@
   // Add lambda-specific data.
   if (Data.IsLambda) {
     CXXRecordDecl::LambdaDefinitionData &Lambda = D->getLambdaData();
+    Record.push_back(Lambda.Dependent);
     Record.push_back(Lambda.NumCaptures);
     Record.push_back(Lambda.NumExplicitCaptures);
+    Record.push_back(Lambda.ManglingNumber);
+    AddDeclRef(Lambda.ContextDecl, Record);
     for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
       LambdaExpr::Capture &Capture = Lambda.Captures[I];
       AddSourceLocation(Capture.getLocation(), Record);

Modified: cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp Tue Feb 21 15:38:41 2012
@@ -541,6 +541,8 @@
 void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
   VisitObjCContainerDecl(D);
   Writer.AddSourceLocation(D->getCategoryNameLoc(), Record);
+  Writer.AddSourceLocation(D->getIvarLBraceLoc(), Record);
+  Writer.AddSourceLocation(D->getIvarRBraceLoc(), Record);
   Writer.AddDeclRef(D->getClassInterface(), Record);
   Record.push_back(D->protocol_size());
   for (ObjCCategoryDecl::protocol_iterator
@@ -593,6 +595,8 @@
 void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
   VisitObjCImplDecl(D);
   Writer.AddDeclRef(D->getSuperClass(), Record);
+  Writer.AddSourceLocation(D->getIvarLBraceLoc(), Record);
+  Writer.AddSourceLocation(D->getIvarRBraceLoc(), Record);
   Writer.AddCXXCtorInitializers(D->IvarInitializers, D->NumIvarInitializers,
                                 Record);
   Record.push_back(D->hasSynthBitfield());

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td Tue Feb 21 15:38:41 2012
@@ -33,7 +33,8 @@
 
 def Unix : Package<"unix">;
 def UnixExperimental : Package<"unix">, InPackage<Experimental>, Hidden;
-def CString : Package<"cstring">, InPackage<UnixExperimental>, Hidden;
+def CString : Package<"cstring">, InPackage<Unix>, Hidden;
+def CStringExperimental : Package<"cstring">, InPackage<UnixExperimental>, Hidden;
 
 def OSX : Package<"osx">;
 def OSXExperimental : Package<"osx">, InPackage<Experimental>, Hidden;
@@ -277,6 +278,10 @@
 def UnixAPIChecker : Checker<"API">,
   HelpText<"Check calls to various UNIX/Posix functions">,
   DescFile<"UnixAPIChecker.cpp">;
+
+def MallocPessimistic : Checker<"Malloc">,
+  HelpText<"Check for memory leaks, double free, and use-after-free problems.">,
+  DescFile<"MallocChecker.cpp">;
   
 } // end "unix"
 
@@ -290,10 +295,6 @@
   HelpText<"Check for memory leaks, double free, and use-after-free problems. Assumes that all user-defined functions which might free a pointer are annotated.">,
   DescFile<"MallocChecker.cpp">;
 
-def MallocPessimistic : Checker<"Malloc">,
-  HelpText<"Check for memory leaks, double free, and use-after-free problems.">,
-  DescFile<"MallocChecker.cpp">;
-
 def MallocSizeofChecker : Checker<"MallocSizeof">,
   HelpText<"Check for dubious malloc arguments involving sizeof">,
   DescFile<"MallocSizeofChecker.cpp">;
@@ -314,6 +315,13 @@
   HelpText<"Check for null pointers being passed as arguments to C string functions">,
   DescFile<"CStringChecker.cpp">;
 
+def CStringSyntaxChecker : Checker<"BadSizeArg">,
+  HelpText<"Check the size argument passed into C string functions for common erroneous patterns">,
+  DescFile<"CStringSyntaxChecker.cpp">;  
+}
+
+let ParentPackage = CStringExperimental in {
+
 def CStringOutOfBounds : Checker<"OutOfBounds">,
   HelpText<"Check for out-of-bounds access in string functions">,
   DescFile<"CStringChecker.cpp">;
@@ -325,10 +333,6 @@
 def CStringNotNullTerm : Checker<"NotNullTerminated">,
   HelpText<"Check for arguments which are not null-terminating strings">,
   DescFile<"CStringChecker.cpp">;
-
-def CStringSyntaxChecker : Checker<"BadSizeArg">,
-  HelpText<"Check the size argument passed into C string functions for common erroneous patterns">,
-  DescFile<"CStringSyntaxChecker.cpp">;  
 }
 
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Tue Feb 21 15:38:41 2012
@@ -447,7 +447,8 @@
   const Expr *ArgExpr = CE->getArg(FunctionsToTrack[idx].Param);
   // If the argument entered as an enclosing function parameter, skip it to
   // avoid false positives.
-  if (isEnclosingFunctionParam(ArgExpr))
+  if (isEnclosingFunctionParam(ArgExpr) &&
+      C.getLocationContext()->getParent() == 0)
     return;
 
   if (SymbolRef V = getAsPointeeSymbol(ArgExpr, C)) {
@@ -481,6 +482,10 @@
   if (!retExpr)
     return;
 
+  // If inside inlined call, skip it.
+  if (C.getLocationContext()->getParent() != 0)
+    return;
+
   // Check  if the value is escaping through the return.
   ProgramStateRef state = C.getState();
   const MemRegion *V =
@@ -549,6 +554,11 @@
 // TODO: Remove this after we ensure that checkDeadSymbols are always called.
 void MacOSKeychainAPIChecker::checkEndPath(CheckerContext &Ctx) const {
   ProgramStateRef state = Ctx.getState();
+
+  // If inside inlined call, skip it.
+  if (Ctx.getLocationContext()->getParent() != 0)
+    return;
+
   AllocatedSetTy AS = state->get<AllocatedData>();
   if (AS.isEmpty())
     return;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Tue Feb 21 15:38:41 2012
@@ -827,6 +827,10 @@
   ProgramStateRef state = C.getState();
   RegionStateTy M = state->get<RegionState>();
 
+  // If inside inlined call, skip it.
+  if (C.getLocationContext()->getParent() != 0)
+    return;
+
   for (RegionStateTy::iterator I = M.begin(), E = M.end(); I != E; ++I) {
     RefState RS = I->second;
     if (RS.isAllocated()) {
@@ -885,8 +889,9 @@
   if (checkUseAfterFree(Sym, C, E))
     return;
 
-  // Check if the symbol is escaping.
-  checkEscape(Sym, E, C);
+  // If this function body is not inlined, check if the symbol is escaping.
+  if (C.getLocationContext()->getParent() == 0)
+    checkEscape(Sym, E, C);
 }
 
 bool MallocChecker::checkUseAfterFree(SymbolRef Sym, CheckerContext &C,

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp Tue Feb 21 15:38:41 2012
@@ -1550,10 +1550,10 @@
 /// CompactPathDiagnostic - This function postprocesses a PathDiagnostic object
 ///  and collapses PathDiagosticPieces that are expanded by macros.
 static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) {
-  typedef std::vector<std::pair<llvm::IntrusiveRefCntPtr<PathDiagnosticMacroPiece>, SourceLocation> >
+  typedef std::vector<std::pair<IntrusiveRefCntPtr<PathDiagnosticMacroPiece>, SourceLocation> >
           MacroStackTy;
 
-  typedef std::vector<llvm::IntrusiveRefCntPtr<PathDiagnosticPiece> >
+  typedef std::vector<IntrusiveRefCntPtr<PathDiagnosticPiece> >
           PiecesTy;
 
   MacroStackTy MacroStack;
@@ -1585,7 +1585,7 @@
 
     // We aren't in the same group.  Are we descending into a new macro
     // or are part of an old one?
-    llvm::IntrusiveRefCntPtr<PathDiagnosticMacroPiece> MacroGroup;
+    IntrusiveRefCntPtr<PathDiagnosticMacroPiece> MacroGroup;
 
     SourceLocation ParentInstantiationLoc = InstantiationLoc.isMacroID() ?
                                           SM.getExpansionLoc(Loc) :

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/Environment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/Environment.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/Environment.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/Environment.cpp Tue Feb 21 15:38:41 2012
@@ -139,7 +139,14 @@
   SymbolReaper &SymReaper;
 public:
   MarkLiveCallback(SymbolReaper &symreaper) : SymReaper(symreaper) {}
-  bool VisitSymbol(SymbolRef sym) { SymReaper.markLive(sym); return true; }
+  bool VisitSymbol(SymbolRef sym) {
+    SymReaper.markLive(sym);
+    return true;
+  }
+  bool VisitMemRegion(const MemRegion *R) {
+    SymReaper.markLive(R);
+    return true;
+  }
 };
 } // end anonymous namespace
 

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp Tue Feb 21 15:38:41 2012
@@ -553,6 +553,10 @@
   if (isVisited)
     return true;
   isVisited = 1;
+  
+  
+  if (!visitor.VisitMemRegion(R))
+    return false;
 
   // If this is a symbolic region, visit the symbol for the region.
   if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R))

Modified: cfe/branches/tooling/test/Analysis/additive-folding.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/additive-folding.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/additive-folding.c (original)
+++ cfe/branches/tooling/test/Analysis/additive-folding.c Tue Feb 21 15:38:41 2012
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.unix.Malloc -verify -analyzer-constraints=basic %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.unix.Malloc -verify -analyzer-constraints=range %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,unix.Malloc -verify -analyzer-constraints=basic %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,unix.Malloc -verify -analyzer-constraints=range %s
 
 // These are used to trigger warnings.
 typedef typeof(sizeof(int)) size_t;

Modified: cfe/branches/tooling/test/Analysis/bstring.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/bstring.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/bstring.c (original)
+++ cfe/branches/tooling/test/Analysis/bstring.c Tue Feb 21 15:38:41 2012
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix.cstring -analyzer-store=region -Wno-null-dereference -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,experimental.unix.cstring -analyzer-store=region -Wno-null-dereference -verify %s
-// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,experimental.unix.cstring -analyzer-store=region -Wno-null-dereference -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,experimental.unix.cstring.NullArg,experimental.unix.cstring.OutOfBounds,experimental.unix.cstring.BufferOverlap,experimental.unix.cstring.NotNullTerminated -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.cstring,experimental.unix.cstring -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,unix.cstring,experimental.unix.cstring -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,unix.cstring,experimental.unix.cstring -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,unix.cstring.NullArg,experimental.unix.cstring.OutOfBounds,experimental.unix.cstring.BufferOverlap,experimental.unix.cstring.NotNullTerminated -analyzer-store=region -Wno-null-dereference -verify %s
 
 //===----------------------------------------------------------------------===
 // Declarations

Modified: cfe/branches/tooling/test/Analysis/cstring-syntax-cxx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/cstring-syntax-cxx.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/cstring-syntax-cxx.cpp (original)
+++ cfe/branches/tooling/test/Analysis/cstring-syntax-cxx.cpp Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.unix.cstring.BadSizeArg -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.cstring.BadSizeArg -analyzer-store=region -verify %s
 
 // Ensure we don't crash on C++ declarations with special names.
 struct X {

Modified: cfe/branches/tooling/test/Analysis/cstring-syntax.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/cstring-syntax.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/cstring-syntax.c (original)
+++ cfe/branches/tooling/test/Analysis/cstring-syntax.c Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.unix.cstring.BadSizeArg -analyzer-store=region -Wno-strlcpy-strlcat-size -Wno-sizeof-array-argument -Wno-sizeof-pointer-memaccess -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.cstring.BadSizeArg -analyzer-store=region -Wno-strlcpy-strlcat-size -Wno-sizeof-array-argument -Wno-sizeof-pointer-memaccess -verify %s
 
 typedef __SIZE_TYPE__ size_t;
 char  *strncat(char *, const char *, size_t);

Modified: cfe/branches/tooling/test/Analysis/free.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/free.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/free.c (original)
+++ cfe/branches/tooling/test/Analysis/free.c Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,experimental.unix.Malloc -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify %s
 // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,experimental.unix.MallocWithAnnotations -fblocks -verify %s
 void free(void *);
 

Modified: cfe/branches/tooling/test/Analysis/keychainAPI.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/keychainAPI.m?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/keychainAPI.m (original)
+++ cfe/branches/tooling/test/Analysis/keychainAPI.m Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=osx.SecKeychainAPI %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=osx.SecKeychainAPI %s -analyzer-inline-call -verify
 
 // Fake typedefs.
 typedef unsigned int OSStatus;
@@ -133,7 +133,7 @@
   return outData;
 } // no-warning
 
-// Password was passed in as an argument and does nt have to be deleted.
+// Password was passed in as an argument and does not have to be deleted.
 OSStatus getPasswordAndItem(void** password, UInt32* passwordLength) {
   OSStatus err;
   SecKeychainItemRef item;
@@ -337,3 +337,63 @@
   } while(10 >= row[1]);
   return row;
 }
+
+// Test inter-procedural behaviour.
+
+void my_FreeParam(void *attrList, void* X) {
+    SecKeychainItemFreeContent(attrList, X); 
+}
+
+void *my_AllocateReturn(OSStatus *st) {
+  unsigned int *ptr = 0;
+  UInt32 length;
+  void *outData;
+  *st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData);
+  return outData;
+}
+
+OSStatus my_Allocate_Param(void** password, UInt32* passwordLength) {
+  OSStatus err;
+  SecKeychainItemRef item;
+  err = SecKeychainFindGenericPassword(0, 3, "xx", 3, "xx",
+                                       passwordLength, password, &item);
+  return err;
+}
+
+void allocAndFree1() {
+    unsigned int *ptr = 0;
+    OSStatus st = 0;
+    UInt32 length;
+    void *outData;
+    st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData);
+    if (st == noErr)
+      my_FreeParam(ptr, outData);
+}
+
+void allocNoFree2() {
+    OSStatus st = 0;
+    void *outData = my_AllocateReturn(&st); // expected-warning{{Allocated data is not released:}}
+}
+
+void allocAndFree2(void *attrList) {
+    OSStatus st = 0;
+    void *outData = my_AllocateReturn(&st);
+    if (st == noErr)
+      my_FreeParam(attrList, outData);
+}
+
+void allocNoFree3() {
+    UInt32 length = 32;
+    void *outData;
+    OSStatus st = my_Allocate_Param(&outData, &length); // expected-warning{{Allocated data is not released}}
+}
+
+void allocAndFree3(void *attrList) {
+    UInt32 length = 32;
+    void *outData;
+    OSStatus st = my_Allocate_Param(&outData, &length); 
+    if (st == noErr)
+      SecKeychainItemFreeContent(attrList, outData);
+
+}
+

Modified: cfe/branches/tooling/test/Analysis/malloc-plist.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc-plist.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc-plist.c (original)
+++ cfe/branches/tooling/test/Analysis/malloc-plist.c Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.unix.Malloc -analyzer-output=plist -o - %s | FileCheck %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.Malloc -analyzer-output=plist -o - %s | FileCheck %s
 
 typedef __typeof(sizeof(int)) size_t;
 void *malloc(size_t);

Modified: cfe/branches/tooling/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc.c (original)
+++ cfe/branches/tooling/test/Analysis/malloc.c Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.core.CastSize,experimental.unix.Malloc -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.core.CastSize,unix.Malloc -analyzer-store=region -verify %s
 #include "system-header-simulator.h"
 
 typedef __typeof(sizeof(int)) size_t;

Modified: cfe/branches/tooling/test/Analysis/malloc.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc.mm?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc.mm (original)
+++ cfe/branches/tooling/test/Analysis/malloc.mm Tue Feb 21 15:38:41 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix.Malloc -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-store=region -verify %s
 
 typedef unsigned int UInt32;
 typedef signed long CFIndex;

Modified: cfe/branches/tooling/test/Analysis/misc-ps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/misc-ps.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/misc-ps.c (original)
+++ cfe/branches/tooling/test/Analysis/misc-ps.c Tue Feb 21 15:38:41 2012
@@ -111,3 +111,18 @@
 void RDar10385775(struct rdar10385775* p) {
     p->name = L"a";
 }
+
+// Test double loop of array and array literals.  Previously this
+// resulted in a false positive uninitailized value warning.
+void rdar10686586() {
+    int array1[] = { 1, 2, 3, 0 };
+    int array2[] = { 1, 2, 3, 0 };
+    int *array[] = { array1, array2 };
+    int sum = 0;
+    for (int i = 0; i < 2; i++) {
+        for (int j = 0; j < 4; j++) {
+            sum += array[i][j]; // no-warning
+        }
+    }
+}
+

Modified: cfe/branches/tooling/test/Analysis/string.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/string.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/string.c (original)
+++ cfe/branches/tooling/test/Analysis/string.c Tue Feb 21 15:38:41 2012
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
-// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=experimental.security.taint,core,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.cstring,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,unix.cstring,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,unix.cstring,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=experimental.security.taint,core,unix.cstring,experimental.unix.cstring,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
 
 //===----------------------------------------------------------------------===
 // Declarations

Modified: cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp (original)
+++ cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp Tue Feb 21 15:38:41 2012
@@ -11,8 +11,25 @@
 struct S { S(); };
 constexpr int f2(S &) { return 0; }
 
+// FIXME: I'm not entirely sure whether the following is legal or not...
+struct BeingDefined;
+extern BeingDefined beingdefined;
+struct BeingDefined { 
+  static constexpr BeingDefined& t = beingdefined;
+};
+
 // - a class type that has all of the following properties:
 
+// (implied) - it is complete
+
+struct Incomplete;
+template<class T> struct ClassTemp {};
+
+constexpr Incomplete incomplete = {}; // expected-error {{constexpr variable cannot have non-literal type 'const Incomplete'}}
+constexpr Incomplete incomplete2[] = {}; // expected-error {{constexpr variable cannot have non-literal type 'Incomplete const[]'}}
+constexpr ClassTemp<int> classtemplate = {};
+constexpr ClassTemp<int> classtemplate2[] = {};
+
 //  - it has a trivial destructor
 struct UserProvDtor {
   constexpr int f(); // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}}

Modified: cfe/branches/tooling/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp (original)
+++ cfe/branches/tooling/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp Tue Feb 21 15:38:41 2012
@@ -75,15 +75,13 @@
 };
 
 // explicit specialization can differ in constepxr
-// FIXME: When checking the explicit specialization, we implicitly instantiate
-// the primary template then claim a constexpr mismatch.
-template <> notlit ft(notlit nl) { return nl; } // unexpected-error {{follows constexpr declaration}} unexpected-note {{here}}
-template <> char ft(char c) { return c; } // desired-note {{previous}} unexpected-error {{follows constexpr declaration}} unexpected-note {{here}}
-template <> constexpr char ft(char nl); // desired-error {{constexpr declaration of 'ft<char>' follows non-constexpr declaration}}
-template <> constexpr int gt(int nl) { return nl; } // unexpected-error {{follows non-constexpr declaration}} unexpected-note {{here}}
-template <> notlit S::f() const { return notlit(); } // unexpected-error {{follows constexpr declaration}} unexpected-note {{here}}
-template <> constexpr int S::g() { return 0; } // desired-note {{previous}} unexpected-error {{follows non-constexpr declaration}} unexpected-note {{here}}
-template <> int S::g() const; // desired-error {{non-constexpr declaration of 'g<int>' follows constexpr declaration}}
+template <> notlit ft(notlit nl) { return nl; }
+template <> char ft(char c) { return c; } // expected-note {{previous}}
+template <> constexpr char ft(char nl); // expected-error {{constexpr declaration of 'ft<char>' follows non-constexpr declaration}}
+template <> constexpr int gt(int nl) { return nl; }
+template <> notlit S::f() const { return notlit(); }
+template <> constexpr int S::g() { return 0; } // expected-note {{previous}}
+template <> int S::g() const; // expected-error {{non-constexpr declaration of 'g<int>' follows constexpr declaration}}
 // specializations can drop the 'constexpr' but not the implied 'const'.
 template <> char S::g() { return 0; } // expected-error {{no function template matches}}
 template <> double S::g() const { return 0; } // ok

Modified: cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp (original)
+++ cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp Tue Feb 21 15:38:41 2012
@@ -8,3 +8,9 @@
   void g4(int = ([=]{ return 0; })());
   void g5(int = ([]{ return sizeof i; })());
 }
+
+namespace lambda_in_default_args {
+  int f(int = [] () -> int { int n; return ++n; } ());
+  template<typename T> T g(T = [] () -> T { T n; return ++n; } ());
+  int k = f() + g<int>();
+}

Modified: cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp Tue Feb 21 15:38:41 2012
@@ -164,3 +164,54 @@
   // CHECK-NOT: call void @_ZN10destroyme1D1Ev
   // CHECK: ret void
 }
+
+struct haslist1 {
+  std::initializer_list<int> il;
+  haslist1();
+};
+
+// CHECK: define void @_ZN8haslist1C2Ev
+haslist1::haslist1()
+// CHECK: alloca [3 x i32]
+// CHECK: store i32 1
+// CHECK: store i32 2
+// CHECK: store i32 3
+// CHECK: store i{{32|64}} 3
+  : il{1, 2, 3}
+{
+  destroyme2 dm2;
+}
+
+struct haslist2 {
+  std::initializer_list<destroyme1> il;
+  haslist2();
+};
+
+// CHECK: define void @_ZN8haslist2C2Ev
+haslist2::haslist2()
+  : il{destroyme1(), destroyme1()}
+{
+  destroyme2 dm2;
+  // CHECK: call void @_ZN10destroyme2D1Ev
+  // CHECK: call void @_ZN10destroyme1D1Ev
+}
+
+void fn10() {
+  // CHECK: define void @_Z4fn10v
+  // CHECK: alloca [3 x i32]
+  // CHECK: call noalias i8* @_Znw{{[jm]}}
+  // CHECK: store i32 1
+  // CHECK: store i32 2
+  // CHECK: store i32 3
+  // CHECK: store i32*
+  // CHECK: store i{{32|64}} 3
+  (void) new std::initializer_list<int> {1, 2, 3};
+}
+
+void fn11() {
+  // CHECK: define void @_Z4fn11v
+  (void) new std::initializer_list<destroyme1> {destroyme1(), destroyme1()};
+  // CHECK: call void @_ZN10destroyme1D1Ev
+  destroyme2 dm2;
+  // CHECK: call void @_ZN10destroyme2D1Ev
+}

Modified: cfe/branches/tooling/test/CodeGenCXX/debug-info-artificial-arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/debug-info-artificial-arg.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/debug-info-artificial-arg.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/debug-info-artificial-arg.cpp Tue Feb 21 15:38:41 2012
@@ -23,7 +23,8 @@
 }
 
 // FIXME: The numbers are truly awful.
-// CHECK: !22 = metadata !{i32 786447, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ]
-// CHECK: metadata !5, metadata !"A", metadata !"A", metadata !"", metadata !6, i32 12, metadata !34, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !36} ; [ DW_TAG_subprogram ]
-// CHECK: metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !35, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
-// CHECK: !35 = metadata !{null, metadata !30, metadata !13, metadata !22}
+// CHECK: !18 = metadata !{i32 786447, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !19} ; [ DW_TAG_pointer_type ]
+// CHECK: !19 = metadata !{i32 786434, null, metadata !"A", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !20, i32 0, metadata !19, null} ; [ DW_TAG_class_type ]
+// CHECK: metadata !19, metadata !"A", metadata !"A", metadata !"", metadata !6, i32 12, metadata !45, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !47} ; [ DW_TAG_subprogram ]
+// CHECK: metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !46, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+// CHECK: !46 = metadata !{null, metadata !18, metadata !9, metadata !34}

Modified: cfe/branches/tooling/test/CodeGenCXX/debug-info-fwd-ref.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/debug-info-fwd-ref.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/debug-info-fwd-ref.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/debug-info-fwd-ref.cpp Tue Feb 21 15:38:41 2012
@@ -19,8 +19,8 @@
 // Make sure we have two DW_TAG_class_types for baz and bar and no forward
 // references.
 // FIXME: These should be struct types to match the declaration.
-// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !7, i32 0, null, null} ; [ DW_TAG_class_type ]
-// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !10, i32 0, null, null} ; [ DW_TAG_class_type ]
+// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !20, i32 0, null, null} ; [ DW_TAG_class_type ]
+// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !23, i32 0, null, null} ; [ DW_TAG_class_type ]
 // CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 9, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 0, i32 0} ; [ DW_TAG_class_type ]
 // CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null} ; [ DW_TAG_class_type ]
 

Modified: cfe/branches/tooling/test/CodeGenCXX/init-invariant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/init-invariant.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/init-invariant.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/init-invariant.cpp Tue Feb 21 15:38:41 2012
@@ -42,19 +42,19 @@
 }
 
 // CHECK: call void @_ZN1AC1Ev({{.*}}* @a)
-// CHECK: call {{.*}}@llvm.invariant.start(i64 -1, i8* bitcast ({{.*}} @a to i8*))
+// CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @a to i8*))
 
 // CHECK: call void @_ZN1BC1Ev({{.*}}* @b)
-// CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 -1, i8* bitcast ({{.*}} @b to i8*))
+// CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @b to i8*))
 
 // CHECK: call void @_ZN1CC1Ev({{.*}}* @c)
-// CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 -1, i8* bitcast ({{.*}} @c to i8*))
+// CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @c to i8*))
 
 // CHECK: call i32 @_Z1fv(
 // CHECK: store {{.*}}, i32* @d
-// CHECK: call {{.*}}@llvm.invariant.start(i64 -1, i8* bitcast ({{.*}} @d to i8*))
+// CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @d to i8*))
 
 // CHECK: define void @_Z1ev(
 // CHECK: call void @_ZN1AC1Ev(%struct.A* @_ZZ1evE1a)
-// CHECK: call {{.*}}@llvm.invariant.start(i64 -1, i8* bitcast ({{.*}} @_ZZ1evE1a to i8*))
+// CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @_ZZ1evE1a to i8*))
 // CHECK-NOT: llvm.invariant.end

Modified: cfe/branches/tooling/test/CodeGenCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/lambda-expressions.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/lambda-expressions.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/lambda-expressions.cpp Tue Feb 21 15:38:41 2012
@@ -1,5 +1,11 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 | FileCheck %s
 
+// CHECK: @var = internal global
+auto var = [](int i) { return i+1; };
+
+// CHECK: @cvar = global
+extern "C" auto cvar = []{};
+
 int a() { return []{ return 1; }(); }
 // CHECK: define i32 @_Z1av
 // CHECK: call i32 @"_ZZ1avENK3$_0clEv"
@@ -55,7 +61,7 @@
 
 void f() {
   // CHECK: define void @_Z1fv()
-  // CHECK: {{call.*_5cvPFiiiEEv}}
+  // CHECK: @"_ZZ1fvENK3$_5cvPFiiiEEv"
   // CHECK-NEXT: store i32 (i32, i32)*
   // CHECK-NEXT: ret void
   int (*fp)(int, int) = [](int x, int y){ return x + y; };

Modified: cfe/branches/tooling/test/CodeGenObjC/debug-info-fwddecl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/debug-info-fwddecl.m?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/debug-info-fwddecl.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/debug-info-fwddecl.m Tue Feb 21 15:38:41 2012
@@ -2,4 +2,4 @@
 @class ForwardObjcClass;
 ForwardObjcClass *ptr = 0;
 
-// CHECK: metadata !{i32 {{.*}}, metadata !{{.*}}, metadata !"ForwardObjcClass", metadata !{{.*}}, i32 2, i64 0, i64 0, i32 0, i32 4, null, null, i32 16, i32 0} ; [ DW_TAG_structure_type ]
+// CHECK: metadata !{i32 {{.*}}, null, metadata !"ForwardObjcClass", metadata !{{.*}}, i32 2, i32 0, i32 0, i32 0, i32 4, null, null, i32 16} ; [ DW_TAG_structure_type ]

Modified: cfe/branches/tooling/test/Driver/gcc-toolchain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/gcc-toolchain.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/gcc-toolchain.cpp (original)
+++ cfe/branches/tooling/test/Driver/gcc-toolchain.cpp Tue Feb 21 15:38:41 2012
@@ -6,7 +6,7 @@
 // RUN:   | FileCheck %s
 
 // CHECK: "-internal-isystem"
-// CHECK: "[[TOOLCHAIN:.*]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5"
+// CHECK: "[[TOOLCHAIN:[^"]+]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5"
 // CHECK: "-internal-isystem"
 // CHECK: "[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/i686-linux-gnu"
 // CHECK: "-internal-isystem"
@@ -19,8 +19,7 @@
 // CHECK: "/include"
 // CHECK: "-internal-externc-isystem"
 // CHECK: "/usr/include"
-// CHECK: "{{.*}}/ld{{(.exe)?}}"
-// CHECK: "{{.*}}crti.o"
-// CHECK: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o"
-// CHECK: "-L{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
-// CHECK: "-L{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
+// CHECK: "{{[^"]*}}ld{{(.exe)?}}"
+// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o"
+// CHECK: "-L{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
+// CHECK: "-L{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."

Modified: cfe/branches/tooling/test/Sema/format-strings.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/format-strings.c?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/format-strings.c (original)
+++ cfe/branches/tooling/test/Sema/format-strings.c Tue Feb 21 15:38:41 2012
@@ -14,6 +14,8 @@
 int vsnprintf(char *, size_t, const char *, va_list);
 int vsprintf(char *restrict, const char *restrict, va_list); // expected-note{{passing argument to parameter here}}
 
+int vscanf(const char *restrict format, va_list arg);
+
 char * global_fmt;
 
 void check_string_literal( FILE* fp, const char* s, char *buf, ... ) {
@@ -23,21 +25,23 @@
   va_start(ap,buf);
 
   printf(s); // expected-warning {{format string is not a string literal}}
-  vprintf(s,ap); // // no-warning
+  vprintf(s,ap); // expected-warning {{format string is not a string literal}}
   fprintf(fp,s); // expected-warning {{format string is not a string literal}}
-  vfprintf(fp,s,ap); // no-warning
+  vfprintf(fp,s,ap); // expected-warning {{format string is not a string literal}}
   asprintf(&b,s); // expected-warning {{format string is not a string lit}}
-  vasprintf(&b,s,ap); // no-warning
+  vasprintf(&b,s,ap); // expected-warning {{format string is not a string literal}}
   sprintf(buf,s); // expected-warning {{format string is not a string literal}}
   snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
   __builtin___sprintf_chk(buf,0,-1,s); // expected-warning {{format string is not a string literal}}
   __builtin___snprintf_chk(buf,2,0,-1,s); // expected-warning {{format string is not a string lit}}
-  vsprintf(buf,s,ap); // no-warning
-  vsnprintf(buf,2,s,ap); // no-warning
+  vsprintf(buf,s,ap); // expected-warning {{format string is not a string lit}}
+  vsnprintf(buf,2,s,ap); // expected-warning {{format string is not a string lit}}
   vsnprintf(buf,2,global_fmt,ap); // expected-warning {{format string is not a string literal}}
-  __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // no-warning
+  __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // expected-warning {{format string is not a string lit}}
   __builtin___vsnprintf_chk(buf,2,0,-1,global_fmt,ap); // expected-warning {{format string is not a string literal}}
 
+  vscanf(s, ap); // expected-warning {{format string is not a string literal}}
+
   // rdar://6079877
   printf("abc"
          "%*d", 1, 1); // no-warning
@@ -51,6 +55,25 @@
   printf("%*d", (unsigned) 1, 1); // no-warning  
 }
 
+__attribute__((__format__ (__printf__, 2, 4)))
+void check_string_literal2( FILE* fp, const char* s, char *buf, ... ) {
+  char * b;
+  va_list ap;
+  va_start(ap,buf);
+
+  printf(s); // expected-warning {{format string is not a string literal}}
+  vprintf(s,ap); // no-warning
+  fprintf(fp,s); // expected-warning {{format string is not a string literal}}
+  vfprintf(fp,s,ap); // no-warning
+  asprintf(&b,s); // expected-warning {{format string is not a string lit}}
+  vasprintf(&b,s,ap); // no-warning
+  sprintf(buf,s); // expected-warning {{format string is not a string literal}}
+  snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
+  __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // no-warning
+
+  vscanf(s, ap); // expected-warning {{format string is not a string literal}}
+}
+
 void check_conditional_literal(const char* s, int i) {
   printf(i == 1 ? "yes" : "no"); // no-warning
   printf(i == 0 ? (i == 1 ? "yes" : "no") : "dont know"); // no-warning

Modified: cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp Tue Feb 21 15:38:41 2012
@@ -127,3 +127,12 @@
   new auto{1, 2, 3}; // expected-error {{cannot use list-initialization}}
   new std::initializer_list<int>{1, 2, 3}; // expected-warning {{at the end of the full-expression}}
 }
+
+struct haslist1 {
+  std::initializer_list<int> il = {1, 2, 3}; // expected-warning{{at the end of the constructor}}
+  haslist1();
+};
+
+haslist1::haslist1()
+: il{1, 2, 3} // expected-warning{{at the end of the constructor}}
+{}

Modified: cfe/branches/tooling/test/SemaCXX/for-range-examples.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/for-range-examples.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/for-range-examples.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/for-range-examples.cpp Tue Feb 21 15:38:41 2012
@@ -169,3 +169,14 @@
   template<typename T> void f() { for (auto a : A()) {} }
   void g() { f<int>(); }
 }
+
+namespace test4 {
+  void f() {
+    int y;
+
+    // Make sure these don't crash. Better diagnostics would be nice.
+    for (: {1, 2, 3}) {} // expected-error {{expected expression}} expected-error {{expected ';'}}
+    for (x : {1, 2, 3}) {} // expected-error {{undeclared identifier}} expected-error {{expected ';'}}
+    for (y : {1, 2, 3}) {} // expected-error {{must declare a variable}} expected-warning {{result unused}}
+  }
+}

Modified: cfe/branches/tooling/test/SemaCXX/format-strings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/format-strings.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/format-strings.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/format-strings.cpp Tue Feb 21 15:38:41 2012
@@ -1,8 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -pedantic %s
 
+#include <stdarg.h>
+
 extern "C" {
 extern int scanf(const char *restrict, ...);
 extern int printf(const char *restrict, ...);
+extern int vprintf(const char *restrict, va_list);
 }
 
 void f(char **sp, float *fp) {
@@ -23,11 +26,12 @@
 public:
   const char *gettext(const char *fmt) __attribute__((format_arg(2)));
 
-  int scanf(const char *restrict, ...) __attribute__((format(scanf, 2, 3)));
-  int printf(const char *restrict, ...) __attribute__((format(printf, 2, 3)));
+  int scanf(const char *, ...) __attribute__((format(scanf, 2, 3)));
+  int printf(const char *, ...) __attribute__((format(printf, 2, 3)));
+  int printf2(const char *, ...);
 
   static const char *gettext_static(const char *fmt) __attribute__((format_arg(1)));
-  static int printf_static(const char *restrict, ...) __attribute__((format(printf, 1, 2)));
+  static int printf_static(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
 };
 
 void h(int *i) {
@@ -52,3 +56,23 @@
   test_null_format(__null); // no-warning
   test_null_format(f); // expected-warning {{not a string literal}}
 }
+
+int Foo::printf(const char *fmt, ...) {
+  va_list ap;
+  va_start(ap,fmt);
+  const char * const format = fmt;
+  vprintf(format, ap); // no-warning
+
+  const char *format2 = fmt;
+  vprintf(format2, ap); // expected-warning{{format string is not a string literal}}
+
+  return 0;
+}
+
+int Foo::printf2(const char *fmt, ...) {
+  va_list ap;
+  va_start(ap,fmt);
+  vprintf(fmt, ap); // expected-warning{{format string is not a string literal}}
+
+  return 0;
+}

Modified: cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp Tue Feb 21 15:38:41 2012
@@ -87,3 +87,17 @@
     []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} 
   }
 }
+
+namespace PR12031 {
+  struct X {
+    template<typename T>
+    X(const T&);
+    ~X();
+  };
+
+  void f(int i, X x);
+  void g() {
+    const int v = 10;
+    f(v, [](){});
+  }
+}

Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 21 15:38:41 2012
@@ -1,2 +1,2 @@
 /cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-150926
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-151084

Modified: cfe/branches/tooling/test/SemaObjC/format-strings-objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/format-strings-objc.m?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/format-strings-objc.m (original)
+++ cfe/branches/tooling/test/SemaObjC/format-strings-objc.m Tue Feb 21 15:38:41 2012
@@ -9,11 +9,13 @@
 // portable to non-Mac platforms.
 //===----------------------------------------------------------------------===//
 
+#include <stdarg.h>
+
 typedef signed char BOOL;
 typedef unsigned int NSUInteger;
 @class NSString, Protocol;
-extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
-extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
+extern void NSLog(NSString *format, ...);
+extern void NSLogv(NSString *format, va_list args);
 typedef struct _NSZone NSZone;
 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
 @protocol NSObject  - (BOOL)isEqual:(id)object; @end
@@ -151,3 +153,26 @@
 void test_toll_free_bridging(CFStringRef x) {
   NSLog(@"%@", x); // no-warning
 }
+
+ at interface Bar
++ (void)log:(NSString *)fmt, ...;
++ (void)log2:(NSString *)fmt, ... __attribute__((format(NSString, 1, 2)));
+ at end
+
+ at implementation Bar
+
++ (void)log:(NSString *)fmt, ... {
+  va_list ap;
+  va_start(ap,fmt);
+  NSLogv(fmt, ap); // expected-warning{{format string is not a string literal}}
+  va_end(ap);
+}
+
++ (void)log2:(NSString *)fmt, ... {
+  va_list ap;
+  va_start(ap,fmt);
+  NSLogv(fmt, ap); // no-warning
+  va_end(ap);
+}
+
+ at end

Modified: cfe/branches/tooling/tools/arcmt-test/arcmt-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/arcmt-test/arcmt-test.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/arcmt-test/arcmt-test.cpp (original)
+++ cfe/branches/tooling/tools/arcmt-test/arcmt-test.cpp Tue Feb 21 15:38:41 2012
@@ -107,8 +107,8 @@
                               ArrayRef<const char *> Args) {
   DiagnosticConsumer *DiagClient =
     new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
       new DiagnosticsEngine(DiagID, DiagClient));
   // Chain in -verify checker, if requested.
   VerifyDiagnosticConsumer *verifyDiag = 0;
@@ -153,8 +153,8 @@
 
   DiagnosticConsumer *DiagClient =
     new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags(
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags(
       new DiagnosticsEngine(DiagID, DiagClient));
 
   CompilerInvocation origCI;

Modified: cfe/branches/tooling/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/driver/cc1_main.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/driver/cc1_main.cpp (original)
+++ cfe/branches/tooling/tools/driver/cc1_main.cpp Tue Feb 21 15:38:41 2012
@@ -118,7 +118,7 @@
 int cc1_main(const char **ArgBegin, const char **ArgEnd,
              const char *Argv0, void *MainAddr) {
   OwningPtr<CompilerInstance> Clang(new CompilerInstance());
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
 
   // Run clang -cc1 test.
   if (ArgBegin != ArgEnd && StringRef(ArgBegin[0]) == "-cc1test") {

Modified: cfe/branches/tooling/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/driver/cc1as_main.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/driver/cc1as_main.cpp (original)
+++ cfe/branches/tooling/tools/driver/cc1as_main.cpp Tue Feb 21 15:38:41 2012
@@ -396,7 +396,7 @@
   TextDiagnosticPrinter *DiagClient
     = new TextDiagnosticPrinter(errs(), DiagnosticOptions());
   DiagClient->setPrefix("clang -cc1as");
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
   DiagnosticsEngine Diags(DiagID, DiagClient);
 
   // Set an error handler, so that any LLVM backend diagnostics go through our

Modified: cfe/branches/tooling/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/driver/driver.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/driver/driver.cpp (original)
+++ cfe/branches/tooling/tools/driver/driver.cpp Tue Feb 21 15:38:41 2012
@@ -373,7 +373,7 @@
   TextDiagnosticPrinter *DiagClient
     = new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
   DiagClient->setPrefix(llvm::sys::path::stem(Path.str()));
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
   DiagnosticsEngine Diags(DiagID, DiagClient);
 
 #ifdef CLANG_IS_PRODUCTION

Modified: cfe/branches/tooling/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/CIndex.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/tooling/tools/libclang/CIndex.cpp Tue Feb 21 15:38:41 2012
@@ -2429,7 +2429,7 @@
   FileSystemOptions FileSystemOpts;
   FileSystemOpts.WorkingDir = CXXIdx->getWorkingDirectory();
 
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
   ASTUnit *TU = ASTUnit::LoadFromASTFile(ast_filename, Diags, FileSystemOpts,
                                   CXXIdx->getOnlyLocalDecls(),
                                   0, 0, true);
@@ -2492,7 +2492,7 @@
   
   // Configure the diagnostics.
   DiagnosticOptions DiagOpts;
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+  IntrusiveRefCntPtr<DiagnosticsEngine>
     Diags(CompilerInstance::createDiagnostics(DiagOpts, num_command_line_args, 
                                                 command_line_args));
 

Modified: cfe/branches/tooling/tools/libclang/CIndexCodeCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/CIndexCodeCompletion.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/CIndexCodeCompletion.cpp (original)
+++ cfe/branches/tooling/tools/libclang/CIndexCodeCompletion.cpp Tue Feb 21 15:38:41 2012
@@ -224,7 +224,7 @@
   SmallVector<StoredDiagnostic, 8> Diagnostics;
 
   /// \brief Diag object
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diag;
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diag;
   
   /// \brief Language options used to adjust source locations.
   LangOptions LangOpts;
@@ -232,10 +232,10 @@
   FileSystemOptions FileSystemOpts;
 
   /// \brief File manager, used for diagnostics.
-  llvm::IntrusiveRefCntPtr<FileManager> FileMgr;
+  IntrusiveRefCntPtr<FileManager> FileMgr;
 
   /// \brief Source manager, used for diagnostics.
-  llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr;
+  IntrusiveRefCntPtr<SourceManager> SourceMgr;
   
   /// \brief Temporary files that should be removed once we have finished
   /// with the code-completion results.
@@ -246,7 +246,7 @@
   SmallVector<const llvm::MemoryBuffer *, 1> TemporaryBuffers;
   
   /// \brief Allocator used to store globally cached code-completion results.
-  llvm::IntrusiveRefCntPtr<clang::GlobalCodeCompletionAllocator> 
+  IntrusiveRefCntPtr<clang::GlobalCodeCompletionAllocator>
     CachedCompletionAllocator;
   
   /// \brief Allocator used to store code completion results.
@@ -282,7 +282,7 @@
                                       const FileSystemOptions& FileSystemOpts)
   : CXCodeCompleteResults(),
     Diag(new DiagnosticsEngine(
-                   llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
+                   IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
     FileSystemOpts(FileSystemOpts),
     FileMgr(new FileManager(FileSystemOpts)),
     SourceMgr(new SourceManager(*Diag, *FileMgr)),

Modified: cfe/branches/tooling/tools/libclang/Indexing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/Indexing.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/Indexing.cpp (original)
+++ cfe/branches/tooling/tools/libclang/Indexing.cpp Tue Feb 21 15:38:41 2012
@@ -279,7 +279,7 @@
 
   // Configure the diagnostics.
   DiagnosticOptions DiagOpts;
-  llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+  IntrusiveRefCntPtr<DiagnosticsEngine>
     Diags(CompilerInstance::createDiagnostics(DiagOpts, num_command_line_args, 
                                                 command_line_args,
                                                 CaptureDiag,
@@ -309,7 +309,7 @@
   if (source_filename)
     Args->push_back(source_filename);
   
-  llvm::IntrusiveRefCntPtr<CompilerInvocation>
+  IntrusiveRefCntPtr<CompilerInvocation>
     CInvok(createInvocationFromCommandLine(*Args, Diags));
 
   if (!CInvok)

Modified: cfe/branches/tooling/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/IndexingContext.h?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/IndexingContext.h (original)
+++ cfe/branches/tooling/tools/libclang/IndexingContext.h Tue Feb 21 15:38:41 2012
@@ -30,7 +30,7 @@
 struct EntityInfo : public CXIdxEntityInfo {
   const NamedDecl *Dcl;
   IndexingContext *IndexCtx;
-  llvm::IntrusiveRefCntPtr<AttrListInfo> AttrList;
+  IntrusiveRefCntPtr<AttrListInfo> AttrList;
 
   EntityInfo() {
     name = USR = 0;

Modified: cfe/branches/tooling/unittests/Basic/SourceManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Basic/SourceManagerTest.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Basic/SourceManagerTest.cpp (original)
+++ cfe/branches/tooling/unittests/Basic/SourceManagerTest.cpp Tue Feb 21 15:38:41 2012
@@ -40,12 +40,12 @@
 
   FileSystemOptions FileMgrOpts;
   FileManager FileMgr;
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID;
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID;
   DiagnosticsEngine Diags;
   SourceManager SourceMgr;
   LangOptions LangOpts;
   TargetOptions TargetOpts;
-  llvm::IntrusiveRefCntPtr<TargetInfo> Target;
+  IntrusiveRefCntPtr<TargetInfo> Target;
 };
 
 class VoidModuleLoader : public ModuleLoader {

Modified: cfe/branches/tooling/unittests/Lex/LexerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Lex/LexerTest.cpp?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Lex/LexerTest.cpp (original)
+++ cfe/branches/tooling/unittests/Lex/LexerTest.cpp Tue Feb 21 15:38:41 2012
@@ -39,12 +39,12 @@
 
   FileSystemOptions FileMgrOpts;
   FileManager FileMgr;
-  llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID;
+  IntrusiveRefCntPtr<DiagnosticIDs> DiagID;
   DiagnosticsEngine Diags;
   SourceManager SourceMgr;
   LangOptions LangOpts;
   TargetOptions TargetOpts;
-  llvm::IntrusiveRefCntPtr<TargetInfo> Target;
+  IntrusiveRefCntPtr<TargetInfo> Target;
 };
 
 class VoidModuleLoader : public ModuleLoader {

Modified: cfe/branches/tooling/utils/analyzer/SATestBuild.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/analyzer/SATestBuild.py?rev=151086&r1=151085&r2=151086&view=diff
==============================================================================
--- cfe/branches/tooling/utils/analyzer/SATestBuild.py (original)
+++ cfe/branches/tooling/utils/analyzer/SATestBuild.py Tue Feb 21 15:38:41 2012
@@ -72,7 +72,7 @@
 
 # The list of checkers used during analyzes.
 # Currently, consists of all the non experimental checkers.
-Checkers="experimental.security.taint,core,deadcode,cplusplus,security,unix,osx,cocoa,experimental.osx.cocoa.Containers,experimental.unix.cstring.BadSizeArg,experimental.unix.Malloc"
+Checkers="experimental.security.taint,core,deadcode,cplusplus,security,unix,osx,cocoa"
 
 Verbose = 1
 





More information about the llvm-branch-commits mailing list