Simplify getting CXXRecordDecl from a base iterator

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185438 91177308-0d34-0410-b5e6-96231b3b80d8
Suppress "control reaches end of non-void function" warning when compiling with gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185439 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Pointers-to-members are (currently) Locs, not NonLocs.

While we don't model pointers-to-members besides "null" and "non-null",
we were using Loc symbols for valid pointers and NonLoc integers for the
null case. This hit the assert committed in r185401.

Fixed by using a true (Loc) null for null member pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185444 91177308-0d34-0410-b5e6-96231b3b80d8
Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185446 91177308-0d34-0410-b5e6-96231b3b80d8
More fixes for block mangling.

Make sure we properly treat names defined inside a block as local
names.  There are basically three fixes here.  One, correctly
treat blocks as a context where we need to use local-name mangling using
the new isLocalContainerContext helper. Two, make
CXXNameMangler::manglePrefix handle local names in a consistent way.
Three, extend CXXNameMangler::mangleLocalName so it can mangle a block
correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185450 91177308-0d34-0410-b5e6-96231b3b80d8
Add regression test for PR12331.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185453 91177308-0d34-0410-b5e6-96231b3b80d8
[ms-cxxabi] Mangle variadic template parameter packs

Unlike Itanium, there is no code to indicate the beginning of a
parameter pack.  I tested this with MSVC 2013, which is the only version
that implements variadic templates so far.

This is needed to compile APInt.cpp for the MS C++ ABI.

Reviewers: timurrrr

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185454 91177308-0d34-0410-b5e6-96231b3b80d8
Debug Info: clean up usage of Verify.

No functionality change. It should suffice to check the type of a debug info
metadata, instead of calling Verify.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185463 91177308-0d34-0410-b5e6-96231b3b80d8
Documentation: Update docs for C++ lambdas to more accurately reflect
C++1y init-capture support, and to improve some Doxygen markup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185469 91177308-0d34-0410-b5e6-96231b3b80d8
Redirect the output of a test to a temporary file to prevent messing up
the test environment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185470 91177308-0d34-0410-b5e6-96231b3b80d8
Debug Info: set default to gdwarf-2 for Darwin.

Darwin systems currently do not support dwarf version 3 or above. When we are
ready, we can bump the default to gdwarf-4 for Darwin.

For other systems, the default is dwarf version 3, if everything goes smoothly,
we can bump the version to 4.

rdar://13591116


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185483 91177308-0d34-0410-b5e6-96231b3b80d8
Look for corrections in enclosing namespaces that require a global NestedNameSpecifier.

CorrectTypo will now see and consider those corrections that are effectively
shadowed by other declarations in a closer context when resolved via an
unqualified lookup. This involves adding any parent namespaces to the set of
namespaces as fully-qualified name specifiers, and also adding potential
corrections that passed name lookup but were rejected by the given
CorrectionCandidateCallback into the set of failed corrections that should be
tried with the set of namespace specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185486 91177308-0d34-0410-b5e6-96231b3b80d8
Allow typo correction to try removing nested name specifiers.

The removal is tried by retrying the failed lookup of a correction
candidate with either the MemberContext or SS (CXXScopeSpecifier) or
both set to NULL if they weren't already. If the candidate identifier
is then looked up successfully, make a note in the candidate that the
SourceRange should include any existing nested name specifier even if
the candidate isn't adding a different one (i.e. the candidate has a
NULL NestedNameSpecifier).

Also tweak the diagnostic messages to differentiate between a suggestion
that just replaces the identifer but leaves the existing nested name
specifier intact and one that replaces the entire qualified identifier,
in cases where the suggested replacement is unqualified.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185493 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Improve handling of noreturn destructors

Summary:
The analyzer incorrectly handled noreturn destructors which were hidden inside
function calls. This happened because NoReturnFunctionChecker only listened for
PostStmt events, which are not executed for destructor calls. I've changed it to
listen to PostCall events, which should catch both cases.

Reviewers: jordan_rose

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185522 91177308-0d34-0410-b5e6-96231b3b80d8
Don't insert confusing line breaks in comparisons.

In general, clang-format breaks after an operator if the LHS spans
multiple lines. Otherwise, this can lead to confusing effects and
effectively hide the operator precendence, e.g. in

if (aaaaaaaaaaaaaa ==
        bbbbbbbbbbbbbb && c) { ...

This patch removes this rule for comparisons, if the LHS is not a binary
expression itself as many users were wondering why clang-format inserts
an unnecessary linebreak.

Before:
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) >
    5) { ...

After:
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) > 5) { ...

In the long run, we might:
- Want to do this for other binary expressions as well.
- Do this only if the RHS is short or even only if it is a literal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185530 91177308-0d34-0410-b5e6-96231b3b80d8
Prevent error message when formatting an empty file.

This fixes llvm.org/PR16514.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185531 91177308-0d34-0410-b5e6-96231b3b80d8
We don't need to know the OpenSUSE version, so don't parse it.

Patch by Johannes Obermayr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185537 91177308-0d34-0410-b5e6-96231b3b80d8
Test case for PR7887 - failed with asm("")


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185543 91177308-0d34-0410-b5e6-96231b3b80d8
Fix PR16454: Don't #include altivec.h when preprocessing assembly.

When the -maltivec flag is present, altivec.h is auto-included for the
compilation.  This is not appropriate when the job action is to
preprocess a file containing assembly code.  So don't do that.

I was unable to convert the test in the bug report into a regression
test.  The original symptom was exposed with:

  % touch x.S
  % ./bin/clang -target powerpc64-unknown-linux-gnu -maltivec -S -o - x.S

I tried this test (and numerous variants) on a PPC64 system:

----------------------------------------------------------------------------
// RUN: touch %t
// RUN: %clang -maltivec -S %t -o - | FileCheck %s

// Verify that assembling an empty file does not auto-include altivec.h.

// CHECK-NOT: static vector
----------------------------------------------------------------------------

However, this test passes for some reason even on a clang built
without the fix.  I'd be happy to add a test case but at this point
I'm not able to figure one out, and I don't want to hold up the patch
unnecessarily.  Please let me know if you have ideas.

Thanks,
Bill


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