PR11926 + duplicates: Fix crash in -Wuninitialized when using a compiler like
g++4.7, which reuses stack space allocated for temporaries. CFGElement::getAs
returns a suitably-cast version of 'this'. Patch by Markus Trippelsdorf!

No test: this code has the same observable behavior as the old code when built
with most compilers, and the tests were already failing when built with a
compiler for which this produced a broken binary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155803 91177308-0d34-0410-b5e6-96231b3b80d8
Correct CFGBlock's front() and back() to return by const ref rather than value.

This ought to fix PR11926, a crash when when running Clang built with GCC 4.7

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155805 91177308-0d34-0410-b5e6-96231b3b80d8
Remove the ref/value inconsistency in filter_decl_iterator.

filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
Restore paren, bracket and brace counts in parser when
TentativeParsingAction is reverted, from Pasi Parviainen! Fixes
PR12480 / <rdar://problem/11341251>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155823 91177308-0d34-0410-b5e6-96231b3b80d8
modern objective-c translation: de-virtualize all
local rewriting functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155826 91177308-0d34-0410-b5e6-96231b3b80d8
Add -Wloop-analysis.  This warning will fire on for loops which the variables
in the loop conditional do not change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155835 91177308-0d34-0410-b5e6-96231b3b80d8
HandleDeclarator() returns NULL for semantic disasters. Deal with it
when we're in an Objective-C container context. Fixes
<rdar://problem/11286701>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155836 91177308-0d34-0410-b5e6-96231b3b80d8
Fix PR12378: provide conversion warnings on default args of function templates

Apparently we weren't checking default arguments when they were instantiated.
This adds the check, fixes the lack of instantiation caching (which seems like
it was mostly implemented but just missed the last step), and avoids
implementing non-dependent default args (for non-dependent parameter types) as
uninstantiated default arguments (so that we don't warn once for every
instantiation when it's not instantiation dependent).

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155838 91177308-0d34-0410-b5e6-96231b3b80d8
Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.

Reviewed by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155839 91177308-0d34-0410-b5e6-96231b3b80d8
Reduce malloc() traffic of clang_getOverridenCursors() by using a pool of SmallVector<CXCursor> objects
under the covers.

Fixes <rdar://problem/11289160>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155841 91177308-0d34-0410-b5e6-96231b3b80d8
Fix C versus C++ linkage issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155842 91177308-0d34-0410-b5e6-96231b3b80d8
minor refactoring of modern objc translator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155843 91177308-0d34-0410-b5e6-96231b3b80d8
Store the source range of a CXXOperatorCallExpr in the Expr object instead of
calculating it recursively.

boost::assign::tuple_list_of uses the trick of chaining call operator expressions in order to declare a "list of tuples", e.g:
    std::vector<tuple> v = boost::assign::tuple_list_of(1, "foo")(2, "bar")(3, "qqq");

Due to CXXOperatorCallExpr calculating its source range recursively we would get
significant slowdowns with a large number of chained call operator expressions and the
potential for stack overflow.

rdar://11350116

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155848 91177308-0d34-0410-b5e6-96231b3b80d8
For RecursiveASTVisitor, do data recursion for CXXOperatorCallExpr.

rdar://11289247

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155849 91177308-0d34-0410-b5e6-96231b3b80d8
modern objective-c translator. named aggregate types
defined inside the objc class belong to class's
decl. scope. This is to conform to objective-c
rules. // rdar://11351299


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155855 91177308-0d34-0410-b5e6-96231b3b80d8
When going through references to check if the function returns the address
of a local variable, make sure we don't infinitely recurse when the
reference binds to itself.

e.g:

int* func() {
    int& i = i;    // assign non-exist variable to a reference which has same name.
    return &i;    // return pointer
}

rdar://11345441

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155856 91177308-0d34-0410-b5e6-96231b3b80d8
Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'
being used in an exception specification in a way which isn't otherwise
ill-formed in C++98: this warning also incorrectly triggered on uses of 'this'
inside thread-safety attributes, and the mechanism required to tell these cases
apart is more complex than can be justified by the (minimal) value of this part
of -Wc++98-compat.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155857 91177308-0d34-0410-b5e6-96231b3b80d8
clang_getCursorLexicalParent should return a translation unit cursor for declarations at the global scope, from Evan P. Fixes PR9083.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155858 91177308-0d34-0410-b5e6-96231b3b80d8
Add support for openSUSE 12.2, from Ismail Donmez!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155860 91177308-0d34-0410-b5e6-96231b3b80d8
malloc size checker: Ignore const'ness of pointer types when determining of a sizeof() type is compatible with a pointed type.

Fixes <rdar://problem/11292586>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155864 91177308-0d34-0410-b5e6-96231b3b80d8