Formatter: @optional and @required go on their own line.

Previously:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional - (void) optional;
@required - (void) required;
@end

Now:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional
- (void)optional;
@required
- (void)required;
@end



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172023 91177308-0d34-0410-b5e6-96231b3b80d8
Formatter: Remove unused @-formatting code.

@optional @property is put on two different unwrapped lines now, so this is no
longer necessary.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172024 91177308-0d34-0410-b5e6-96231b3b80d8
Rework the realpath nonsense for framework lookups to deal more
uniformly with symlinks between top-level and embedded frameworks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172030 91177308-0d34-0410-b5e6-96231b3b80d8
Don't assert in codegen on static data members which have NoLinkage. Fixes
PR14825!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172031 91177308-0d34-0410-b5e6-96231b3b80d8
Be more careful about updating the failed-modules set

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172035 91177308-0d34-0410-b5e6-96231b3b80d8
clang-c/Index.h: Clarify empty argument with (void) for C89.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172037 91177308-0d34-0410-b5e6-96231b3b80d8
Testing with a full OpenCL compiler (based on clang) reveals r71734 missed
difference between type widths of a vector and the width of one of its elements
in the case of vector shifts. Use correct witdth in the vector case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172047 91177308-0d34-0410-b5e6-96231b3b80d8
Do more error checking for '{}'.

This fixes llvm.org/PR14883, where clang-format would run into an
assertion on:

void f() { return } 42

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172049 91177308-0d34-0410-b5e6-96231b3b80d8
Introduce a define to switch on debug output.

After re-writing the same loop multiple times, we deicided it's time to
add this as an optional debugging help.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172050 91177308-0d34-0410-b5e6-96231b3b80d8
Enable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that enabled this extension for multiple targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172052 91177308-0d34-0410-b5e6-96231b3b80d8
r172047 lacked a test (due to incomplete OpenCL support in clang). Use a modified
version of a test by Joey Gouly to use attributes to materialise the unsupported
types and test vector shifts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172053 91177308-0d34-0410-b5e6-96231b3b80d8
Improve clang-format's understanding of casts.

This fixes llvm.org/PR14684.

Before: int *pa = (int *) & a;
After:  int *pa = (int *)&a;

We still don't understand all kinds of casts. I added a FIXME to
address that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172056 91177308-0d34-0410-b5e6-96231b3b80d8
Fix layout of blocks inside statements.

Previously, we would not indent:
SOME_MACRO({
  int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO({, so the formatter can correctly match
the braces and indent accordingly.

Also fixes incorrect parsing of initializer lists, like:
int a[] = { 1 };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172058 91177308-0d34-0410-b5e6-96231b3b80d8
[Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
the backend if hard float ABI is selected under -mips16 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172062 91177308-0d34-0410-b5e6-96231b3b80d8
Improvements to function type and ObjC block formatting.

Before: int (^myBlock) (int) = ^(int num) {}
        A<void ()>;
	int (*b)(int);

After:  int (^myBlock)(int) = ^(int num) {}
        A<void()>;
	int(*b)(int);

For function types and function pointer types, this patch only makes
the behavior consistent (for types that are keywords and other types).
For the latter function pointer type declarations, we'll probably
want to add a space after "int".

Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately
Moved the LangOpts-settings to a public place for use by tests
and clang-format binary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172065 91177308-0d34-0410-b5e6-96231b3b80d8
Do not add newline in empty blocks.

void f() {}
now gets formatted in one line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172067 91177308-0d34-0410-b5e6-96231b3b80d8
Fixes formatting of function calls etc inside an initializer list.

We're now formatting (column limit 25):
int x = {
  avariable,
  b(alongervariable) };

This also fixes:
Aaa({
  int i;
}, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
                                    ccccccccccccccccc));
... where we would previously break after the '},'.

Putting the closing curly into an extra line when there's a break
directly after the first curly will be done in a subsequent patch.

Paired with djasper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172070 91177308-0d34-0410-b5e6-96231b3b80d8
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