Fix regression in r172376. Don't try to detect missing 'constexpr' specifiers
on redeclarations, since that makes us pick wrong prior declarations under
some circumstances.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172384 91177308-0d34-0410-b5e6-96231b3b80d8
Add extra tests for [[gnu::...]] attributes, missed from r172382.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172391 91177308-0d34-0410-b5e6-96231b3b80d8
Adds some more tests for * and &.

While reviewing r172303 I noticed that I wasn't sure whether we still
format those correctly and didn't see any tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172396 91177308-0d34-0410-b5e6-96231b3b80d8
Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.

Summary:
Added tests for clang-format diagnostics. Added DiagnosticConsumer
argument to clang::format::reformat().

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits, thakis, rafael.espindola

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172399 91177308-0d34-0410-b5e6-96231b3b80d8
Improve understanding post increment and decrement.

Before: (a->f()) ++;
        a[42] ++;
After:  (a->f())++;
        a[42]++;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172400 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor datastructure used in clang-format.

Main difference, add an AnnotatedLine class to hold information about a
line while formatting. At the same time degrade the UnwrappedLine class
to a class solely used for communicating between the UnwrappedLineParser
and the Formatter.

No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172403 91177308-0d34-0410-b5e6-96231b3b80d8
clang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown, or it doesn't work for targetting win32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172404 91177308-0d34-0410-b5e6-96231b3b80d8
Dump comments in -ast-dump.
http://llvm-reviews.chandlerc.com/D269

"Added dumping of declaration comments in ASTDumper. This required moving the
comment dumping code from CommentDumper so that the indentation is correct."

Patch by Philip Craig!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172409 91177308-0d34-0410-b5e6-96231b3b80d8
Put short if statements on a single line.

Before: if (a)
          return;
After:  if (a) return;

Not yet sure, whether this is always desired, but we can add options and
make this a style parameter as we go along.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172413 91177308-0d34-0410-b5e6-96231b3b80d8
Turns out there is a simpler way of getting a set difference in bash than parsing diff output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172420 91177308-0d34-0410-b5e6-96231b3b80d8
Put simple preprocessor directives on a single line.

Before: #define A  \
          A
After:  #define A A

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172423 91177308-0d34-0410-b5e6-96231b3b80d8
Fix bug that would lead to joining preprocessor directives.

Before: #include "a.h" #include "b.h"
After:  #include "a.h"
        #include "b.h"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172424 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a bug in the line merging.

If the first line of a merge would exactly fit into the column limit,
an unsigned overflow made us not break.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172426 91177308-0d34-0410-b5e6-96231b3b80d8
Make single-line if statements optional.

Now, "if (a) return;" is only allowed, if this option is set.

Also add a Chromium style which is currently identical to Google style
except for this option.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172431 91177308-0d34-0410-b5e6-96231b3b80d8
Fixes formatting of nested brace initializers.

We now format this correctly:
Status::Rep Status::global_reps[3] = {
  { kGlobalRef, OK_CODE, NULL, NULL, NULL },
  { kGlobalRef, CANCELLED_CODE, NULL, NULL, NULL },
  { kGlobalRef, UNKNOWN_CODE, NULL, NULL, NULL }
};

- fixed a bug where BreakBeforeClosingBrace would be set on the wrong
  state
- added penalties for breaking between = and {, and between { and any
  other non-{ token

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172433 91177308-0d34-0410-b5e6-96231b3b80d8
Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.

The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,

  link "clangAST"

or

  link framework "MyFramework"

Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.

For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172437 91177308-0d34-0410-b5e6-96231b3b80d8
This patch addresses varargs processing for small complex types under
the 64-bit PowerPC ELF ABI.

The ABI requires that the real and imaginary parts of a complex argument
each occupy their own doubleword.  Arguments smaller than 8 bytes are
right-adjusted within the doubleword.

Clang expects EmitVAARG() to return a pointer to a structure in which
the real and imaginary parts are packed adjacently in memory.  To accomplish
this, we generate code to load the code appropriately from the varargs
location and pack the values into a temporary variable in the form Clang
expects, returning a pointer to that structure.

The test case demonstrates correct code generation for all "small" complex
types on PPC64:  int, short, char, and float.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172438 91177308-0d34-0410-b5e6-96231b3b80d8
Infer "link" lines for top-level frameworks. Essentially, a framework
will have a shared library with the same name as its framework (and no
suffix!) within its .framework directory. Detect this both when
inferring the whole top-level framework and when parsing a module map.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172439 91177308-0d34-0410-b5e6-96231b3b80d8
Switch autolinking metadata format over to actual linker options, e.g.,

  !0 = metadata !{metadata !"-lautolink"}
  !1 = metadata !{metadata !"-framework", metadata !"autolink_framework"}

referenced from llvm.module.linkoptions, e.g.,

  !llvm.module.linkoptions = !{!0, !1, !2, !3}

This conceptually moves the logic for figuring out the syntax the
linker will accept from LLVM into Clang. Moreover, it makes it easier
to support MSVC's

  #pragma comment(linker, "some option")

in the future, should anyone care to do so.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172441 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] -drain is not an alias for -release.

This was previously added to support -[NSAutoreleasePool drain], which
behaves like -release under non-GC and "please collect" under GC. We're
not currently modeling the autorelease pool stack, though, so we can
just take this out entirely.

Fixes PR14927.

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