Use the awesome CHECK-DAG!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182167 91177308-0d34-0410-b5e6-96231b3b80d8
Thread safety analysis: add two new attributes to the thread safety analysis:
assert_exclusive_lock and assert_shared_lock.  These attributes are used to
mark functions that dynamically check (i.e. assert) that a lock is held.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182170 91177308-0d34-0410-b5e6-96231b3b80d8
ObjC Debug Info: Emit the correct method names for accessors for
properties declared in a protocol.

rdar://problem/13798000

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182176 91177308-0d34-0410-b5e6-96231b3b80d8
Drop the const from the isa test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182178 91177308-0d34-0410-b5e6-96231b3b80d8
Handle local enum types too.

Thanks to John McCall for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182182 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "[analyzer; alternate edges] improve support for edges with PseudoObjectExprs."

Ted and I spent a long time discussing this today and found out that neither
the existing code nor the new code was doing what either of us thought it
was, which is never good. The good news is we found a much simpler way to
fix the motivating test case (an ObjCSubscriptExpr).

This reverts r182083, but pieces of it will come back in subsequent commits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182185 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Add a debug dump for PathPieces, a list of PathDiagnosticPieces.

Originally implemented by Ted, extended by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182186 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] "Fix" ParentMap to handle non-syntactic OpaqueValueExprs.

Constructs like PseudoObjectExpr, where an expression can appear more than
once in the AST, use OpaqueValueExprs to guard against inadvertent
re-processing of the shared expression during AST traversal. The most
common form of this is to share expressions between the syntactic
"as-written" form of, say, an Objective-C property access 'obj.prop', and
the underlying "semantic" form '[obj prop]'.

However, some constructs can produce OpaqueValueExprs that don't appear in
the syntactic form at all; in these cases the ParentMap wasn't ever traversing
the children of these expressions. This patch fixes that by checking to see
if an OpaqueValueExpr's child has ever been traversed before. There's also a
bit of reset logic when visiting a PseudoObjectExpr to handle the case of
updating the ParentMap, which some external clients depend on.

This still isn't exactly the right fix because we probably want the parent
of the OpaqueValueExpr itself to be its location in the syntactic form if
it's syntactic and the PseudoObjectExpr or BinaryConditionalOperator itself
if it's semantic. Whe I originally wrote the code to do this, I didn't realize
that OpaqueValueExprs themselves are shared in the AST, not just their source
expressions. This patch doesn't change the existing behavior so as not to
break anything inadvertently relying on it; we'll come back to this later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182187 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] New edges: include an edge to the end-of-path location.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182189 91177308-0d34-0410-b5e6-96231b3b80d8
Slight reorganization of the fast-math tests which test for errno
setting. Consolidate the collection of tests that enable -fmath-errno
and share a single CHECK line for simplicity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182202 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a logic bug in the handling of -fmath-errno in the driver. We would
imply -fno-math-errno if the user passed -fno-fast-math OR -ffast-math,
regardless of in which order and regardless of the tool chain default.

I've fixed this to follow the logic:

1) If the last dominating flag is -fno-math-errno, -ffast-math, or
   -Ofast, then do not use math-errno.
2) If the last dominating flag is an explicit -fmath-errno, do use
   math-errno.
3) Otherwise, use the toolchain default.

This, for example, allows the flag sequence
'-ffast-math ... -fno-fast-math' with no mention of '-fmath-errno' or
'-fno-math-errno' to preserve the toolchain default. Most notably, this
should prevent users trying to disable fast-math optimizations on Darwin
and BSD platforms from simultaneously enabling (pointless) -fmath-errno.

I've enhanced the tests (after more reorganization) to cover this and
other weird permutations of flags and targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182203 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Extend the checker developer manual. A patch by Sam Handler!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182204 91177308-0d34-0410-b5e6-96231b3b80d8
Clang-format: allow -style="{yaml/json}" on command line

Summary: + improved handling of default style and predefined styles.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182205 91177308-0d34-0410-b5e6-96231b3b80d8
Tests and status for core issues 1-50.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182207 91177308-0d34-0410-b5e6-96231b3b80d8
OpenBSD/sparc64 uses long long for int64_t and intmax_t.

Other operating systems, including FreeBSD and NetBSD, use long.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182215 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.""

This reverts commit r181947 (git d2990ce56a16050cac0d7937ec9919ff54c6df62 )

This addresses one of the two issues identified in r181947, ensuring
that types imported via using declarations only result in a declaration
being emitted for the type, not a definition. The second issue (emitting
using declarations that are unused) is hopefully an acceptable increase
as the real fix for this would be a bit difficult (probably at best we
could record which using directives were involved in lookups - but may
not have been the result of the lookup).

This also ensures that DW_TAG_imported_declarations (& directives) are
not emitted in line-tables-only mode as well as ensuring that typedefs
only require/emit declarations (rather than definitions) for referenced
types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182231 91177308-0d34-0410-b5e6-96231b3b80d8
Add -Wincomplete-module, which detects when a header is included from a module but isn't itself part of a module.


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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182264 91177308-0d34-0410-b5e6-96231b3b80d8
Implement __declspec(selectany) under -fms-extensions

selectany only applies to externally visible global variables.  It has
the effect of making the data weak_odr.

The MSDN docs suggest that unused definitions can only be dropped at
linktime, so Clang uses weak instead of linkonce.  MSVC optimizes away
references to constant selectany data, so it must assume that there is
only one definition, hence weak_odr.

Reviewers: espindola

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

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