Fix memory corruption in CStringChecker

Summary:
"register" functions for the checker were caching the checker objects in a
static variable. This caused problems when the function is called with a
different CheckerManager.

Reviewers: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183823 91177308-0d34-0410-b5e6-96231b3b80d8
Silencing a signed vs unsigned comparison mismatch in MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183837 91177308-0d34-0410-b5e6-96231b3b80d8
Fix buildbot breakage on PPC64.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183847 91177308-0d34-0410-b5e6-96231b3b80d8
Port HTMLDiagnostics to PathV2. No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183849 91177308-0d34-0410-b5e6-96231b3b80d8
Preserve newlines before block comments in static initializers.

Summary:
Basically, don't special-case line comments in this regard. And fixed
an incorrect test, that relied on the wrong behavior.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183851 91177308-0d34-0410-b5e6-96231b3b80d8
Retain linker flags specified on cmake command line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183857 91177308-0d34-0410-b5e6-96231b3b80d8
Reapply r183721, reverted in r183776, with a fix for a bug in the former (we
were lacking ExprWithCleanups nodes in some cases where the new approach to
lifetime extension needed them).

Original commit message:

Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183859 91177308-0d34-0410-b5e6-96231b3b80d8
Use the global functions instead of the Program methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183861 91177308-0d34-0410-b5e6-96231b3b80d8
Introducing -Wheader-guard, a warning that checks header guards actually work
properly.  This warning checks that the #ifndef and #define directives at
the beginning of a header refer to the same macro name.  Includes a fix-it
hint to correct the header guard.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183867 91177308-0d34-0410-b5e6-96231b3b80d8
Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.


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

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
Don't suggest putting 'operator new' or 'operator delete' in a namespace to fix a two-phase lookup issue. That's not permitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183874 91177308-0d34-0410-b5e6-96231b3b80d8
Simplify: we don't need any special-case lifetime extension when initializing
declarations of reference type; they're handled by the general case handling of
MaterializeTemporaryExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183875 91177308-0d34-0410-b5e6-96231b3b80d8
Include the unexpanded packs in the initializer expression when checking a
pack expanded constructor initializer list. Fixes PR16303!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183878 91177308-0d34-0410-b5e6-96231b3b80d8
When copy-initializing a temporary for a reference binding, don't allow use of
explicit constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183879 91177308-0d34-0410-b5e6-96231b3b80d8
Add -Wdeprecated warnings and fixits for things deprecated in C++11:
 - 'register' storage class
 - dynamic exception specifications

Only the former check is enabled by default for now (the latter might be quite noisy).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183881 91177308-0d34-0410-b5e6-96231b3b80d8
In C++11, promote access declaration diagnostic from warning to error. There
doesn't seem to be any value in even adding a -W flag for this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183882 91177308-0d34-0410-b5e6-96231b3b80d8
Implement core issue 903: only integer literals with value 0 and prvalues of
type std::nullptr_t are null pointer constants from C++11 onwards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183883 91177308-0d34-0410-b5e6-96231b3b80d8
C++11: If a class has a user-declared copy operation or destructor, the
implicit definition of a copy operation is deprecated. Add a warning for this
to -Wdeprecated. This warning is disabled by default for now, pending
investigation into how common this situation is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183884 91177308-0d34-0410-b5e6-96231b3b80d8
Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're
not actually talking about a default constructor.


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