]> granicus.if.org Git - clang/log
clang
11 years agoTest commit.
Enea Zaffanella [Fri, 11 Jan 2013 11:37:08 +0000 (11:37 +0000)]
Test commit.

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

11 years agoRefactor IndentState into two classes.
Daniel Jasper [Fri, 11 Jan 2013 10:22:12 +0000 (10:22 +0000)]
Refactor IndentState into two classes.

As we keep adding more stuff to it, this structure is easier to
maintain. At one point we might think about making it an actual
class with specific accessors, etc.

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

11 years agoPass false instead of 0 since isStar parameter of getArray has type bool. No function...
Nikola Smiljanic [Fri, 11 Jan 2013 08:33:05 +0000 (08:33 +0000)]
Pass false instead of 0 since isStar parameter of getArray has type bool. No functionality change.

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

11 years agoFix spelling error and remove the part about CMake having experimental Ninja support...
Nikola Smiljanic [Fri, 11 Jan 2013 07:23:53 +0000 (07:23 +0000)]
Fix spelling error and remove the part about CMake having experimental Ninja support since 2.8.9 has been released some time ago.

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

11 years agoRevert the line ending mess I made.
Nikola Smiljanic [Fri, 11 Jan 2013 07:14:58 +0000 (07:14 +0000)]
Revert the line ending mess I made.

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

11 years agoFix spelling error and remove the part about CMake having experimental Ninja support...
Nikola Smiljanic [Fri, 11 Jan 2013 07:09:00 +0000 (07:09 +0000)]
Fix spelling error and remove the part about CMake having experimental Ninja support since 2.8.9 has been released some time ago.

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

11 years ago[analyzer] Rename the warning: state the issue before the hint of how it
Anna Zaks [Fri, 11 Jan 2013 03:52:44 +0000 (03:52 +0000)]
[analyzer] Rename the warning: state the issue before the hint of how it
can be fixed

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

11 years ago[analyzer]Recognize ivar invalidation protocol even if it was redeclared
Anna Zaks [Fri, 11 Jan 2013 03:52:40 +0000 (03:52 +0000)]
[analyzer]Recognize ivar invalidation protocol even if it was redeclared

This will get rid of some false positives as well as false negatives.

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

11 years ago[analyzer] Ivar invalidation: track ivars declared in categories.
Anna Zaks [Fri, 11 Jan 2013 03:52:37 +0000 (03:52 +0000)]
[analyzer] Ivar invalidation: track ivars declared in categories.

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

11 years agoRevert "tg-fixits.td: fixup for Linux"
Jordan Rose [Fri, 11 Jan 2013 02:37:47 +0000 (02:37 +0000)]
Revert "tg-fixits.td: fixup for Linux"

It's better to show no caret/ranges/fixits than to show them misaligned.
(It scares me a bit that Clang is going to show them misaligned on
systems without a proper llvm::sys::locale::columnWidth.) See PR14910.

This reverts commit a03cc72bedd015b7eb76e9ac650992f58a48549d.

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

11 years agoReplace more usages of __func__ with LLVM_FUNCTION_NAME
Dmitri Gribenko [Fri, 11 Jan 2013 02:23:13 +0000 (02:23 +0000)]
Replace more usages of __func__ with LLVM_FUNCTION_NAME

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

11 years agolibclang logging: fixup for MSVC, which does not have __func__
Dmitri Gribenko [Fri, 11 Jan 2013 01:15:02 +0000 (01:15 +0000)]
libclang logging: fixup for MSVC, which does not have __func__

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

11 years agoImprove on my last test for patch for // rdar://12897704
Fariborz Jahanian [Fri, 11 Jan 2013 00:55:44 +0000 (00:55 +0000)]
Improve on my last test for patch for // rdar://12897704

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

11 years agotg-fixits.td: fixup for Linux, which does not have a correct implementation of
Dmitri Gribenko [Fri, 11 Jan 2013 00:37:33 +0000 (00:37 +0000)]
tg-fixits.td: fixup for Linux, which does not have a correct implementation of
llvm::sys::locale::columnWidth()

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

11 years agoTruth in advertising: LocallyScopedExternalDecls actually only contains
Richard Smith [Thu, 10 Jan 2013 23:43:47 +0000 (23:43 +0000)]
Truth in advertising: LocallyScopedExternalDecls actually only contains
external declarations with C language linkage.

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

11 years ago[analyzer] Allow IvarInvalidation checker to suppress warnings via
Anna Zaks [Thu, 10 Jan 2013 23:34:16 +0000 (23:34 +0000)]
[analyzer] Allow IvarInvalidation checker to suppress warnings via
assertions.

To ensure that custom assertions/conditional would also be supported,
just check if the ivar that needs to be invalidated or set to nil is
compared against 0.

Unfortunately, this will not work for code containing 'assert(IvarName)'

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

11 years agoc++ IRGen. In trivial cases that object is going into static
Fariborz Jahanian [Thu, 10 Jan 2013 23:28:43 +0000 (23:28 +0000)]
c++ IRGen. In trivial cases that object is going into static
storage and thus is implicitly zero-initialized, no need to
do C++11 memory model. This patch unconditionally detects
such condition and zeroinitializer's the variable.
Patch has been commented on and OKed by Doug off-line.
// rdar://12897704

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

11 years agoFormatter: Remove a fixme, Jordy says @synthesize is good as is.
Nico Weber [Thu, 10 Jan 2013 23:12:29 +0000 (23:12 +0000)]
Formatter: Remove a fixme, Jordy says @synthesize is good as is.

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

11 years agoFormatter: Put spaces in ObjC method decls in the right place for Google style.
Nico Weber [Thu, 10 Jan 2013 23:11:41 +0000 (23:11 +0000)]
Formatter: Put spaces in ObjC method decls in the right place for Google style.

Objective-C method declarations look like this:

- (returntype)name:(type)argname anothername:(type)arg2name;

In google style, there's no space after the leading '-' but one after
"(returntype)" instead (but none after the argument types), see
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions

Not inserting the space after '-' is easy, but to insert the space after the
return type, the formatter needs to know that a closing parenthesis ends the
return type. To do this, I tweaked the code in parse() to check for this, which
in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to
parse(), because parse() runs before annotate().

(To keep things interesting, the return type is optional, but it's almost
always there in practice.)

http://llvm-reviews.chandlerc.com/D280

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

11 years ago[analyzer] Fix non-determinizm introduced in r172104.
Anna Zaks [Thu, 10 Jan 2013 22:44:16 +0000 (22:44 +0000)]
[analyzer] Fix non-determinizm introduced in r172104.

In some cases, we just pick any ivar that needs invalidation and attach
the warning to it. Picking the first from DenseMap of pointer keys was
triggering non-deterministic output.

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

11 years agoToolChains: Minor touchup to use correct type, avoid truncation.
Will Dietz [Thu, 10 Jan 2013 22:20:02 +0000 (22:20 +0000)]
ToolChains: Minor touchup to use correct type, avoid truncation.

Truncation happens regularly when find_first_not_of returns npos,
strings long enough to trigger bug here are implausible.

No functionality change intended (ignoring absurd string lengths).

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

11 years agoDeclare +new instead of -new in test.
Fariborz Jahanian [Thu, 10 Jan 2013 22:17:49 +0000 (22:17 +0000)]
Declare +new instead of -new in test.

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

11 years ago[ms-inline asm] Add test case for r172121.
Chad Rosier [Thu, 10 Jan 2013 22:11:28 +0000 (22:11 +0000)]
[ms-inline asm] Add test case for r172121.
Part of rdar://12991541

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

11 years ago[ms-inline asm] Extend the inline asm Sema lookup interface to determine if the
Chad Rosier [Thu, 10 Jan 2013 22:10:16 +0000 (22:10 +0000)]
[ms-inline asm] Extend the inline asm Sema lookup interface to determine if the
Decl is a VarDecl.
Part of rdar://12991541

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

11 years agoFormatter: No spaces around '=' in @property lines.
Nico Weber [Thu, 10 Jan 2013 21:30:42 +0000 (21:30 +0000)]
Formatter: No spaces around '=' in @property lines.

Before:
@property(assign, getter = isEditable) BOOL editable;

Now:
@property(assign, getter=isEditable) BOOL editable;

It'd be nice if some Apple person could let me know if spaces are preferred
around '=' in @synthesize lines (see FIXME in the test).

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

11 years ago[analyzer] Add more checks to the ObjC Ivar Invalidation checker.
Anna Zaks [Thu, 10 Jan 2013 20:59:51 +0000 (20:59 +0000)]
[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

11 years agoIn my last patch use InGroup<Switch> (per Dmitri's comment).
Fariborz Jahanian [Thu, 10 Jan 2013 20:47:57 +0000 (20:47 +0000)]
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

11 years agoProvide a better warning when case value overflows.
Fariborz Jahanian [Thu, 10 Jan 2013 20:26:42 +0000 (20:26 +0000)]
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

11 years agoFormatter: Land header change I forgot to land in r172099.
Nico Weber [Thu, 10 Jan 2013 20:19:27 +0000 (20:19 +0000)]
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

11 years agoFormatter: Add test for template and protocol parameters in ObjC method declarations.
Nico Weber [Thu, 10 Jan 2013 20:18:33 +0000 (20:18 +0000)]
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

11 years agoFormatting: In @implementation etc lines, put a space before protocol lists.
Nico Weber [Thu, 10 Jan 2013 20:12:55 +0000 (20:12 +0000)]
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

11 years agoRefactoring the outermost structure of the formatter.
Manuel Klimek [Thu, 10 Jan 2013 19:49:59 +0000 (19:49 +0000)]
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

11 years ago[libclang] Address some coding style issues pointed out by Dmitri.
Argyrios Kyrtzidis [Thu, 10 Jan 2013 19:43:44 +0000 (19:43 +0000)]
[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

11 years agoFormatter: Don't put a space in ObjC number literals like @+50
Nico Weber [Thu, 10 Jan 2013 19:36:35 +0000 (19:36 +0000)]
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

11 years agoccc-analyzer: Forward -msse* options to the compiler.
Ted Kremenek [Thu, 10 Jan 2013 19:29:31 +0000 (19:29 +0000)]
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

11 years agoFormatter: Add space before '(' in @implemenation, @interface, @protocol lines
Nico Weber [Thu, 10 Jan 2013 19:19:14 +0000 (19:19 +0000)]
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

11 years agoPull calculation whether a line fits one level up.
Manuel Klimek [Thu, 10 Jan 2013 19:17:33 +0000 (19:17 +0000)]
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

11 years agoobjectiveC++: When throwing c++ exception of
Fariborz Jahanian [Thu, 10 Jan 2013 19:02:56 +0000 (19:02 +0000)]
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

11 years ago[libclang] Add missing header file
Argyrios Kyrtzidis [Thu, 10 Jan 2013 18:58:44 +0000 (18:58 +0000)]
[libclang] Add missing header file

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

11 years ago[libclang] Enhance logging capabilities of libclang.
Argyrios Kyrtzidis [Thu, 10 Jan 2013 18:54:52 +0000 (18:54 +0000)]
[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

11 years agoDiagnostics: name all implicit groups used more than once.
Jordan Rose [Thu, 10 Jan 2013 18:50:51 +0000 (18:50 +0000)]
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

11 years agoError if an anonymous DiagGroup is referenced multiple times.
Jordan Rose [Thu, 10 Jan 2013 18:50:46 +0000 (18:50 +0000)]
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

11 years agoPulling formatFirstToken one level up.
Manuel Klimek [Thu, 10 Jan 2013 18:45:26 +0000 (18:45 +0000)]
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

11 years agoFixes layout of right braces.
Manuel Klimek [Thu, 10 Jan 2013 15:58:26 +0000 (15:58 +0000)]
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

11 years agoBasic support for diagnostics.
Alexander Kornienko [Thu, 10 Jan 2013 15:05:09 +0000 (15:05 +0000)]
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

11 years agoFixes formatting of function calls etc inside an initializer list.
Manuel Klimek [Thu, 10 Jan 2013 14:36:46 +0000 (14:36 +0000)]
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

11 years agoDo not add newline in empty blocks.
Manuel Klimek [Thu, 10 Jan 2013 13:24:24 +0000 (13:24 +0000)]
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

11 years agoImprovements to function type and ObjC block formatting.
Daniel Jasper [Thu, 10 Jan 2013 13:08:12 +0000 (13:08 +0000)]
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

11 years ago[Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
Simon Atanasyan [Thu, 10 Jan 2013 12:36:19 +0000 (12:36 +0000)]
[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

11 years agoFix layout of blocks inside statements.
Manuel Klimek [Thu, 10 Jan 2013 11:52:21 +0000 (11:52 +0000)]
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

11 years agoImprove clang-format's understanding of casts.
Daniel Jasper [Thu, 10 Jan 2013 11:14:08 +0000 (11:14 +0000)]
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

11 years agor172047 lacked a test (due to incomplete OpenCL support in clang). Use a modified
David Tweed [Thu, 10 Jan 2013 10:42:08 +0000 (10:42 +0000)]
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

11 years agoEnable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that enabled...
Guy Benyei [Thu, 10 Jan 2013 10:41:05 +0000 (10:41 +0000)]
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

11 years agoIntroduce a define to switch on debug output.
Manuel Klimek [Thu, 10 Jan 2013 10:05:08 +0000 (10:05 +0000)]
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

11 years agoDo more error checking for '{}'.
Daniel Jasper [Thu, 10 Jan 2013 09:26:47 +0000 (09:26 +0000)]
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

11 years agoTesting with a full OpenCL compiler (based on clang) reveals r71734 missed
David Tweed [Thu, 10 Jan 2013 09:11:33 +0000 (09:11 +0000)]
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

11 years agoclang-c/Index.h: Clarify empty argument with (void) for C89.
NAKAMURA Takumi [Thu, 10 Jan 2013 02:12:38 +0000 (02:12 +0000)]
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

11 years agoBe more careful about updating the failed-modules set
Douglas Gregor [Thu, 10 Jan 2013 02:04:18 +0000 (02:04 +0000)]
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

11 years agoDon't assert in codegen on static data members which have NoLinkage. Fixes
Nick Lewycky [Thu, 10 Jan 2013 01:46:29 +0000 (01:46 +0000)]
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

11 years agoRework the realpath nonsense for framework lookups to deal more
Douglas Gregor [Thu, 10 Jan 2013 01:43:00 +0000 (01:43 +0000)]
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

11 years agoFormatter: Remove unused @-formatting code.
Nico Weber [Thu, 10 Jan 2013 00:42:07 +0000 (00:42 +0000)]
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

11 years agoFormatter: @optional and @required go on their own line.
Nico Weber [Thu, 10 Jan 2013 00:25:19 +0000 (00:25 +0000)]
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

11 years agoFormatter: Add support for @implementation.
Nico Weber [Wed, 9 Jan 2013 23:25:37 +0000 (23:25 +0000)]
Formatter: Add support for @implementation.

Just reuse the @interface code for this. It accepts slightly more than
necessary (@implementation cannot have protocol lists), but that's ok.

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

11 years ago[PreprocessingRecord] A macro expansion can be reported out-of-order in cases when
Argyrios Kyrtzidis [Wed, 9 Jan 2013 23:22:20 +0000 (23:22 +0000)]
[PreprocessingRecord] A macro expansion can be reported out-of-order in cases when
there are macro expansions inside macro arguments where the arguments are
not expanded in the same order as listed; don't assert that all macro expansions
are in source order.

rdar://12397063

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

11 years ago[utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the...
Argyrios Kyrtzidis [Wed, 9 Jan 2013 23:22:08 +0000 (23:22 +0000)]
[utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the value.

Some lldb changes made lldb.frame not set until a script is invoked, which made the
formatters not working after a restart.

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

11 years agoIssue warning when case value is too large to fit
Fariborz Jahanian [Wed, 9 Jan 2013 23:04:56 +0000 (23:04 +0000)]
Issue warning when case value is too large to fit
in case condition type. // rdar://11577384.
Test is conditionalized on x86_64-apple triple as
I am not sure if the INT_MAX/LONG_MAX values in the test
will pass this test for other hosts.

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

11 years agoClangTools.rst: spelling and formatting
Dmitri Gribenko [Wed, 9 Jan 2013 22:22:51 +0000 (22:22 +0000)]
ClangTools.rst: spelling and formatting

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

11 years agoClangFormat.rst: improve formatting
Dmitri Gribenko [Wed, 9 Jan 2013 22:18:55 +0000 (22:18 +0000)]
ClangFormat.rst: improve formatting

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

11 years agoRemove the unused Parser::ParseTranslationUnit function
Hal Finkel [Wed, 9 Jan 2013 21:49:51 +0000 (21:49 +0000)]
Remove the unused Parser::ParseTranslationUnit function

Parser::ParseTranslationUnit is now dead because the loop over
ParseTopLevelDecl is in ParseAST.

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

11 years agoAdd documentation for clang-format.
Daniel Jasper [Wed, 9 Jan 2013 21:49:28 +0000 (21:49 +0000)]
Add documentation for clang-format.

This adds documentation for both LibFormat as well as the standalone
tools and integrations built on top of it. It slightly restructures
the ClangTools documentation.

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

11 years agoFormatter: Make parseObjCUntilAtEnd() actually work.
Nico Weber [Wed, 9 Jan 2013 21:42:32 +0000 (21:42 +0000)]
Formatter: Make parseObjCUntilAtEnd() actually work.

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

11 years agoFormatting: Add support for @protocol.
Nico Weber [Wed, 9 Jan 2013 21:15:03 +0000 (21:15 +0000)]
Formatting: Add support for @protocol.

Pull pieces of the @interface code into reusable methods.

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

11 years agoFix test after r171995.
Nico Weber [Wed, 9 Jan 2013 20:36:10 +0000 (20:36 +0000)]
Fix test after r171995.

I wasn't aware libFormat is used elsewhere already. Let me know if rebasing
is not the right thing to do here.

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

11 years agoFormatter: Add support for @interface.
Nico Weber [Wed, 9 Jan 2013 20:25:35 +0000 (20:25 +0000)]
Formatter: Add support for @interface.

Previously:
@interface Foo + (id)init; @end

Now:
@interface Foo
+ (id)init;
@end

Some tweaking remains, but this is a good first step.

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

11 years agounwind.h: Add include guards and don't mess with visibility if HIDE_EXPORTS is specified.
Benjamin Kramer [Wed, 9 Jan 2013 19:54:57 +0000 (19:54 +0000)]
unwind.h: Add include guards and don't mess with visibility if HIDE_EXPORTS is specified.

For GCC compatibility.

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

11 years agoDo not model loads from complex types, since we don't accurately model the imaginary...
Ted Kremenek [Wed, 9 Jan 2013 18:46:17 +0000 (18:46 +0000)]
Do not model loads from complex types, since we don't accurately model the imaginary and real parts yet.

Fixes false positive reported in <rdar://problem/12964481>.

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

11 years agoSuppress GCC -Wreturn warning.
David Blaikie [Wed, 9 Jan 2013 17:48:41 +0000 (17:48 +0000)]
Suppress GCC -Wreturn warning.

Modified from a patch by David Greene.

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

11 years agoHandle static functions being redeclared in function scope.
Rafael Espindola [Wed, 9 Jan 2013 16:34:58 +0000 (16:34 +0000)]
Handle static functions being redeclared in function scope.

Fixes pr14861.

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

11 years agoEnables layouting unwrapped lines around preprocessor directives.
Manuel Klimek [Wed, 9 Jan 2013 15:25:02 +0000 (15:25 +0000)]
Enables layouting unwrapped lines around preprocessor directives.

Previously, we'd always start at indent level 0 after a preprocessor
directive, now we layout the following snippet (column limit 69) as
follows:

functionCallTo(someOtherFunction(
    withSomeParameters, whichInSequence,
    areLongerThanALine(andAnotherCall,
  B
                       withMoreParamters,
                       whichStronglyInfluenceTheLayout),
    andMoreParameters),
               trailing);

Note that the different jumping indent is a different issue that will be
addressed separately.

This is the first step towards handling #ifdef->#else->#endif chains
correctly.

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

11 years agoEnable intel_ocl_bicc for x86_64 target. This was missed in r171056.
Guy Benyei [Wed, 9 Jan 2013 12:21:44 +0000 (12:21 +0000)]
Enable intel_ocl_bicc for x86_64 target. This was missed in r171056.

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

11 years agoOnly align after assignments on the top level.
Daniel Jasper [Wed, 9 Jan 2013 10:40:23 +0000 (10:40 +0000)]
Only align after assignments on the top level.

This fixes llvm.org/PR14870 and we no longer mess up:
template <typename T1, typename T2 = char, typename T3 = char,
          typename T4 = char>
void f();

It removes the nice aligment for assignments inside other expressions,
but I am not sure those are actually practically relevant. If so, we can
fix those later.

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

11 years agoDon't simply give up when exceeding 80cols, choose an "ok" option.
Daniel Jasper [Wed, 9 Jan 2013 10:16:05 +0000 (10:16 +0000)]
Don't simply give up when exceeding 80cols, choose an "ok" option.

This addresses llvm.org/PR14847.

We can now format something like:
int aaaaaaaaaaaaaaaaaaaaaaaaaaa =
    // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

clang-format unavoidably exceeds the column limit, but does not just
flush everything into a single line. Moreover, it tries to minimize the
number of characters beyond the column limit.

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

11 years agoCorrectly format wrapped function call parameters in templated functions.
Daniel Jasper [Wed, 9 Jan 2013 09:50:48 +0000 (09:50 +0000)]
Correctly format wrapped function call parameters in templated functions.

This fixes llvm.org/PR14846.

Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        int aaaaaaaaaaaaaaaaa);

After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    int aaaaaaaaaaaaaaaaa);

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

11 years agoFixes dump_ast_matchers to parse all matcher macros and updates the
Manuel Klimek [Wed, 9 Jan 2013 09:38:21 +0000 (09:38 +0000)]
Fixes dump_ast_matchers to parse all matcher macros and updates the
docs.

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

11 years agoAllow comments in the middle of statements to be on their own line.
Daniel Jasper [Wed, 9 Jan 2013 09:33:39 +0000 (09:33 +0000)]
Allow comments in the middle of statements to be on their own line.

This fixes llvm.org/PR14860.

Before, we messed up the format of:
if (DeclaratorInfo.isFunctionDeclarator() &&
    //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level &&
    Tok.is(tok::semi) && NextToken().is(tok::l_brace)) {
}

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

11 years agoFix ObjC block declarations.
Daniel Jasper [Wed, 9 Jan 2013 08:36:49 +0000 (08:36 +0000)]
Fix ObjC block declarations.

Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
After:  int (^Block1) (int, int) = ^(int i, int j)

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

11 years agoImprove formatting of conditional operators.
Daniel Jasper [Wed, 9 Jan 2013 07:06:56 +0000 (07:06 +0000)]
Improve formatting of conditional operators.

This addresses llvm.org/PR14864.

We used to completely mess this up and now format as:
Diag(NewFD->getLocation(),
     getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class :
         diag::err_function_specialization_in_class)
    << NewFD->getDeclName();

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

11 years agoDon't mention -fno-diagnostics-print-source-range-info in manual.
Nico Weber [Wed, 9 Jan 2013 05:06:41 +0000 (05:06 +0000)]
Don't mention -fno-diagnostics-print-source-range-info in manual.

Clang doesn't understand it.

If someone wants to teach clang about that flag instead, please also add
support for -fno-diagnostics-parseable-fixits for consistency.

Until then, let the documentation match the current behavior.

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

11 years ago[ubsan] Make static check data non-const so it can be used for deduplication.
Will Dietz [Wed, 9 Jan 2013 03:39:41 +0000 (03:39 +0000)]
[ubsan] Make static check data non-const so it can be used for deduplication.

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

11 years agoMake sure clang puts tokens from different files on separate lines in "-E -P" mode...
Eli Friedman [Wed, 9 Jan 2013 03:16:42 +0000 (03:16 +0000)]
Make sure clang puts tokens from different files on separate lines in "-E -P" mode.  <rdar://problem/12774044>

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

11 years agoMake __has_include a bit more resilient in the presence of macros. <rdar://problem...
Eli Friedman [Wed, 9 Jan 2013 02:20:00 +0000 (02:20 +0000)]
Make __has_include a bit more resilient in the presence of macros.  <rdar://problem/12748859>.

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

11 years agoWhen name lookup for a redeclaration finds declarations that are known
Douglas Gregor [Wed, 9 Jan 2013 00:47:56 +0000 (00:47 +0000)]
When name lookup for a redeclaration finds declarations that are known
(because they are part of some module) but have not been made visible
(because they are in a submodule that wasn't imported), filter out
those declarations unless both the old declaration and the new
declaration have external linkage. When one or both has internal
linkage, there should be no conflict unless both are imported.

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

11 years agoput back diagnostics when flexible members are captured
Fariborz Jahanian [Wed, 9 Jan 2013 00:09:15 +0000 (00:09 +0000)]
put back diagnostics when flexible members are captured
in lambdas.

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

11 years agoRemoved extra "`" from ARC documentation.
Michael Gottesman [Tue, 8 Jan 2013 23:55:10 +0000 (23:55 +0000)]
Removed extra "`" from ARC documentation.

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

11 years ago[ms-inline asm] Add a test case for the offset operator where the operand is a
Chad Rosier [Tue, 8 Jan 2013 23:51:48 +0000 (23:51 +0000)]
[ms-inline asm] Add a test case for the offset operator where the operand is a
global variable.

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

11 years agoFix typo (again).
Fariborz Jahanian [Tue, 8 Jan 2013 23:48:48 +0000 (23:48 +0000)]
Fix typo (again).

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

11 years agoRemove lambda from my last patch.
Fariborz Jahanian [Tue, 8 Jan 2013 23:40:08 +0000 (23:40 +0000)]
Remove lambda from my last patch.

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

11 years agoFixes typo in comment.
Fariborz Jahanian [Tue, 8 Jan 2013 23:21:22 +0000 (23:21 +0000)]
Fixes typo in comment.

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

11 years agoobjectiveC blocks: It is impractical to capture
Fariborz Jahanian [Tue, 8 Jan 2013 23:17:51 +0000 (23:17 +0000)]
objectiveC blocks: It is impractical to capture
struct variables with flexiable array members in
blocks (and lambdas). Issue error instead of
crashing in IRGen. // rdar://12655829

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

11 years agoPR14855: don't silently swallow a nested-name-specifier after a type name.
Richard Smith [Tue, 8 Jan 2013 22:43:49 +0000 (22:43 +0000)]
PR14855: don't silently swallow a nested-name-specifier after a type name.

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