Correct handling of _Pragma macro inside a macro argument.

If we are pre-expanding a macro argument don't actually "activate"
the pragma at that point, activate the pragma whenever we encounter
it again in the token stream.
This ensures that we will activate it in the correct location
or that we will ignore it if it never enters the token stream, e.g:

     \#define EMPTY(x)
     \#define INACTIVE(x) EMPTY(x)
     INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\""))

This also fixes the crash in rdar://11168596.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153959 91177308-0d34-0410-b5e6-96231b3b80d8
modern objective-c translator: rewriter linkage spec.
// rdar://11169733


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153960 91177308-0d34-0410-b5e6-96231b3b80d8
Replace the workaround from r153445 with a proper fix.

Infinite recursion was happening when DiagnoseInvalidRedeclaration
called ActOnFunctionDeclarator to check if a typo correction works when
the correction was just to the nested-name-specifier because the wrong
DeclContext was being passed in. Unlike a number of functions
surrounding typo correction, the DeclContext passed in for a function is
the context of the function name after applying any nested name
specifiers, not the lexical DeclContext where the
function+nested-name-specifier appears.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153962 91177308-0d34-0410-b5e6-96231b3b80d8
Don't treat synthesized ivars as being in the base class for the purpose of
looking up visible decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153967 91177308-0d34-0410-b5e6-96231b3b80d8
Remove more redundant lookups. Add a new "all_lookups_iterator" which provides
a view over the contents of a DeclContext without exposing the implementation
details of the StoredDeclsMap. Use this in LookupVisibleDecls to find the
visible declarations. Fixes PR12339!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153970 91177308-0d34-0410-b5e6-96231b3b80d8
Eliminate obvious use-after-free. Fixes PR12433 / <rdar://problem/11168333>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153982 91177308-0d34-0410-b5e6-96231b3b80d8
Add feature check "cxx_local_type_template_args" describing support
for templates with local template arguments, from Michel Morin! Fixes
PR12337.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153983 91177308-0d34-0410-b5e6-96231b3b80d8
Remove dead assignment to local variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153985 91177308-0d34-0410-b5e6-96231b3b80d8
Silence dead store warning, and fix indentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153986 91177308-0d34-0410-b5e6-96231b3b80d8
Change BugReporter's usage of IsCachedDiagnostic to only impact pruning diagnostics emitted to the
console, and leave it up to PathDiagnosticConsumer to unique reports with the shortest path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153987 91177308-0d34-0410-b5e6-96231b3b80d8
Fix dead store warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153988 91177308-0d34-0410-b5e6-96231b3b80d8
Enter an expression evaluation context when parsing
statement-expressions.  Prevents cleanups and such from being
claimed by the first full-expression in the block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153989 91177308-0d34-0410-b5e6-96231b3b80d8
ErrorUnsupported on array cookies in the MS C++ ABI code;
patch by Timur Iskhodzhanov.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153990 91177308-0d34-0410-b5e6-96231b3b80d8
If something already instantiated is reinstantiated as an explicit definition,
keep the latter.

No test. This was noticed when poking around something else with GDB. I'm not
able to figure out a testcase that would break due to this bug. Sorry.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153992 91177308-0d34-0410-b5e6-96231b3b80d8
When computing the conversion sequence in overload resolution
for converting an empty list to a scalar, be sure to initialize
the source and destination types so that comparison of conversion
sequences will work in case there are multiple viable candidates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153993 91177308-0d34-0410-b5e6-96231b3b80d8
[preprocessor] In Preprocessor::CachingLex() check whether there were more tokens
cached during the non-cached lex, otherwise we are going to drop them.

Fixes a bogus "_Pragma takes a parenthesized string literal" error when
expanding consecutive _Pragmas in a macro argument.

Part of rdar://11168596

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153994 91177308-0d34-0410-b5e6-96231b3b80d8
Dependent-sequence initialization of a single element can be direct
list-initialization. Loosen an over-eager assertion to fix PR12453.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153995 91177308-0d34-0410-b5e6-96231b3b80d8
When performing template argument deduction for an initializer list,
be sure to perform the argument type adjustments in
[temp.deduct.call]p2, e.g., array decay.

And, when performing these deductions in the context of 'auto', make
sure that we're deducing the P' in std::initializer_list<P'> rather
than the whole initializer list.

Together, this makes code like

  for( auto s : {"Deferred", "New", "Open", "Review"}) { }

work properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153998 91177308-0d34-0410-b5e6-96231b3b80d8
For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this is
a type specifier and can be combined with unsigned. This allows libstdc++4.7 to
be used with clang in c++98 mode.

Several other changes are still required for libstdc++4.7 to work with clang in
c++11 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153999 91177308-0d34-0410-b5e6-96231b3b80d8
Fix diagnostic typos: "non-template arguments" vs "non-type template arguments".
No test updates: we don't appear to have any test coverage for these diagnostics!


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