Basic support for diagnostics.

Summary: Uses DiagnosticsEngine to output diagnostics.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172071 91177308-0d34-0410-b5e6-96231b3b80d8
Fixes layout of right braces.

We now decide whether a newline should go before the closing brace
depending on whether a newline was inserted after the opening brace.

For example, we now insert a newline before '};' in:
static SomeClass WithALoooooooooooooooooooongName = {
  100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"
};
... while not inserting a newline here:
static SomeClass = { a, b, c, d, e, f, g, h, i, j,
                     looooooooooooooooooooooooooooooooooongname,
                     looooooooooooooooooooooooooooooong };

Also fixes the formating of (column limit 25):
int x = {
  avariable,
  b(alongervariable)
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172076 91177308-0d34-0410-b5e6-96231b3b80d8
Pulling formatFirstToken one level up.

This prepares the code for single line optimizations and changes the
dependencies between single-line-formats to the indent of the first
token.

Conceptually, the first token is "between" the lines anyway, as the
whitespace for the first token includes the previous end-of-line, which
needs to be escaped when inside a preprocessor directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172083 91177308-0d34-0410-b5e6-96231b3b80d8
Error if an anonymous DiagGroup is referenced multiple times.

Not only is this inefficient for TableGen, it's annoying for maintenance
when renaming warning flags (unusual) or adding those flags to a group
(more likely).

This uses the new fix-it infrastructure for LLVM's SourceMgr/SMDiagnostic,
as well as a few changes to TableGen to track more source information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172087 91177308-0d34-0410-b5e6-96231b3b80d8
Diagnostics: name all implicit groups used more than once.

This will be a new style requirement going forwards: a diagnostic can only
use the implicit InGroup<DiagGroup<"foo">> syntax if "foo" is not used by
any other diagnostics; as soon as it is, it needs an explicit group.

This also brings some stray "conversion" diagnostics into the
"Value Conversion Issue" category, instead of the more generic
"Semantic Issue" category. I consider this an improvement!
- warn_impcast_complex_scalar
- warn_impcast_float_integer
- warn_impcast_float_precision
- warn_impcast_integer_precision
- warn_impcast_vector_scalar

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172088 91177308-0d34-0410-b5e6-96231b3b80d8
[libclang] Enhance logging capabilities of libclang.

-provide a "raw_ostream'ish" class to make it convenient to output logging info.
-use macros to automate a bit the logging functionality inside libclang functions
-when logging, print a stack trace if "LIBCLANG_LOGGING=2" environment is set.
-add logging to more functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172089 91177308-0d34-0410-b5e6-96231b3b80d8
[libclang] Add missing header file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172090 91177308-0d34-0410-b5e6-96231b3b80d8
objectiveC++: When throwing c++ exception of 
an objectiveC object, use objc_exception_throw
to raise the exception. // rdar://12605907


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172091 91177308-0d34-0410-b5e6-96231b3b80d8
Pull calculation whether a line fits one level up.

This is the next step towards being able to configure multiple unwrapped
lines into one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172092 91177308-0d34-0410-b5e6-96231b3b80d8
Formatter: Add space before '(' in @implemenation, @interface, @protocol lines

The first token in @implementation, @interface, and @protocol lines is now
marked TT_ObjCDecl, and lines starting with a TT_ObjCDecl token are now marked
LT_ObjCMethodDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172093 91177308-0d34-0410-b5e6-96231b3b80d8
ccc-analyzer: Forward -msse* options to the compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172094 91177308-0d34-0410-b5e6-96231b3b80d8
Formatter: Don't put a space in ObjC number literals like @+50

Before:
@ -4.5

Now:
@-4.5



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172095 91177308-0d34-0410-b5e6-96231b3b80d8
[libclang] Address some coding style issues pointed out by Dmitri.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172096 91177308-0d34-0410-b5e6-96231b3b80d8
Refactoring the outermost structure of the formatter.

This is the last step of pure shuffling stuff around, the next step will
be the actual feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172098 91177308-0d34-0410-b5e6-96231b3b80d8
Formatting: In @implementation etc lines, put a space before protocol lists.

Don't do this in Google style though:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols

Most other places (function declarations, variable declarations) still get
this wrong, and since this looks very similiar to template instantiations to
the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some
places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172099 91177308-0d34-0410-b5e6-96231b3b80d8
Formatter: Add test for template and protocol parameters in ObjC method declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172100 91177308-0d34-0410-b5e6-96231b3b80d8
Formatter: Land header change I forgot to land in r172099.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172101 91177308-0d34-0410-b5e6-96231b3b80d8
Provide a better warning when case value overflows.
// rdar://11577384


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172102 91177308-0d34-0410-b5e6-96231b3b80d8
In my last patch use InGroup<Switch> (per Dmitri's comment).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172103 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Add more checks to the ObjC Ivar Invalidation checker.

Restructured the checker so that it could easily find two new classes of
issues:
 - when a class contains an invalidatable ivar, but no declaration of an
invalidation method
 - when a class contains an invalidatable ivar, but no definition of an
invalidation method in the @implementation.

The second case might trigger some false positives, for example, when
the method is defined in a category.

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