Displaying 1 50 of 245 commits (0.037s)

LLVM — cfe/trunk/lib/AST ASTContext.cpp, cfe/trunk/test/Rewriter objc-modern-property-attributes.mm

Objective-C: Correctly encode 'retain' and 'copy' for readonly properties.

clang would omit 'C' for 'copy' properties and '&' for 'retain' properties if
the property was also 'readonly'. Fix this, which makes clang match gcc4.2's
behavior.

Fixes PR15928.
Delta File
+12 -0 cfe/trunk/test/Rewriter/objc-modern-property-attributes.mm
+4 -0 cfe/trunk/lib/AST/ASTContext.cpp
+16 -0 2 files

LLVM — cfe/trunk/include/clang/Driver Options.td, cfe/trunk/lib/Driver Tools.cpp

Add support for gcc's spelling of -fcolor-diagnostics.

See http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html
Delta File
+53 -0 cfe/trunk/test/Driver/color-diagnostics.c
+36 -3 cfe/trunk/lib/Driver/Tools.cpp
+3 -0 cfe/trunk/include/clang/Driver/Options.td
+92 -3 3 files

LLVM — cfe/trunk/include/clang/Basic DiagnosticParseKinds.td, cfe/trunk/include/clang/Parse Parser.h

Make the ObjC attributes diagnostics a bit more informative.
Delta File
+10 -6 cfe/trunk/lib/Parse/ParseObjc.cpp
+5 -5 cfe/trunk/test/Parser/attributes.mm
+3 -0 cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
+1 -1 cfe/trunk/include/clang/Parse/Parser.h
+19 -12 4 files

LLVM — cfe/trunk/include/clang/Basic DiagnosticParseKinds.td, cfe/trunk/include/clang/Parse Parser.h

Emit a nicer diagnostic for misplaced attributes on ObjC directives.
Delta File
+25 -0 cfe/trunk/test/Parser/attributes.mm
+15 -0 cfe/trunk/lib/Parse/ParseObjc.cpp
+0 -8 cfe/trunk/test/Parser/prefix-attributes.m
+2 -0 cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
+1 -0 cfe/trunk/include/clang/Parse/Parser.h
+43 -8 5 files

LLVM — cfe/trunk/lib/CodeGen CGDebugInfo.cpp CGDebugInfo.h, cfe/trunk/test/CodeGenCXX debug-info.cpp

Revert r178079, it caused PR15637.

Also add a test for PR15637.
Delta File
+33 -15 cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
+7 -0 cfe/trunk/test/CodeGenCXX/debug-info.cpp
+1 -1 cfe/trunk/lib/CodeGen/CGDebugInfo.h
+41 -16 3 files

LLVM — cfe/trunk/lib/AST ASTContext.cpp

Remove a pointless assertion.

FindNodeOrInsertPos() is called 10 lines earlier already, and the function
early-returns there if the result is != 0. InsertPos isn't recomputed after
that check, so this assert is always trivially true. (And it has nothing to
do with if T is canonical or not.)
Delta File
+1 -5 cfe/trunk/lib/AST/ASTContext.cpp
+1 -5 1 file

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: And more cast tests (these don't pass yet).
Delta File
+2 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -0 1 file

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Add more cast tests.
Delta File
+9 -1 cfe/trunk/unittests/Format/FormatTest.cpp
+9 -1 1 file

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Refactor the cast detection code to be a bit more readable.

No functionality change. Also add another cast test.
Delta File
+10 -9 cfe/trunk/lib/Format/TokenAnnotator.cpp
+1 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+11 -9 2 files

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Detect ObjC method expressions after casts.

Not all casts are correctly detected yet, but it helps in some cases.
Delta File
+2 -1 cfe/trunk/unittests/Format/FormatTest.cpp
+1 -1 cfe/trunk/lib/Format/TokenAnnotator.cpp
+3 -2 2 files

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Correctly format stars in `sizeof(int**)` and similar places.

This redoes how '*' and '&' are classified as pointer / reference markers when
followed by ')', '>', or ','.

Previously, determineStarAmpUsage() marked a single '*' and '&' followed by
')', '>', or ',' as pointer or reference marker. Now, all '*'s and '&'s
preceding ')', '>', or ',' are marked as pointer / reference markers. Fixes
PR14884.

Since only the last '*' in 'int ***' was marked as pointer before (the rest
were unary operators, which don't reach spaceRequiredBetween()),
spaceRequiredBetween() now had to be thought about handing multiple '*'s in
sequence.

Before:
  return sizeof(int * *);
  Type **A = static_cast<Type * *>(P);

Now:
  return sizeof(int**);
  Type **A = static_cast<Type **>(P);

While here, also make all methods of AnnotatingParser except parseLine()
private.

    [2 lines not shown]
Delta File
+20 -14 cfe/trunk/lib/Format/TokenAnnotator.cpp
+9 -2 cfe/trunk/unittests/Format/FormatTest.cpp
+29 -16 2 files

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp TokenAnnotator.h, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Detect ObjC message expressions after 'in' in loop

Before:
  for (id foo in[self getStuffFor : bla]) {
  }

Now:
  for (id foo in [self getStuffFor:bla]) {
  }

"in" is treated as loop keyword if the line starts with "for", and as a
regular identifier else. To check for "in", its IdentifierInfo is handed
through a few layers.
Delta File
+11 -3 cfe/trunk/lib/Format/TokenAnnotator.cpp
+7 -2 cfe/trunk/lib/Format/TokenAnnotator.h
+4 -1 cfe/trunk/lib/Format/Format.cpp
+4 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+26 -6 4 files

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp

Formatter: Remove now-unneeded code for formatting ':'s in ObjC method decls.

The more general code for formatting ObjC method exprs does this and more,
it's no longer necessary to special-case this. No behavior change.
Delta File
+0 -21 cfe/trunk/lib/Format/TokenAnnotator.cpp
+0 -21 1 file

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Add a test for multi-line ObjC dict literals.

As it turns out, this already works reasonably well.

This example from http://clang.llvm.org/docs/ObjectiveCLiterals.html
NSDictionary *dictionary = @{
    @"name" : NSUserName(),
    @"date" : [NSDate date],
    @"processInfo" : [NSProcessInfo processInfo]
};

is formatted like
NSDictionary *dictionary = @{ @"name" : NSUserName(), @"date" : [NSDate date],
                              @"processInfo" : [NSProcessInfo processInfo] };

There's already a FIXME in NestedStaticInitializers about supporting one
initializer per line, which is really all that's missing here too.
Delta File
+3 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+3 -0 1 file

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Add another ObjC literal test.

(From http://clang.llvm.org/docs/ObjectiveCLiterals.html.)
Delta File
+2 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -0 1 file

LLVM — cfe/trunk/lib/Format UnwrappedLineParser.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Initial support for ObjC dictionary literals.

Before:
  @{
  foo:
    bar
  }
  ;

Now:
  @{ foo : bar };

parseBracedList() already does the right thing from an UnwrappedLineParser
perspective, so check for "@{" in all loops that process constructs that can
contain expressions and call parseBracedList() if found.
Delta File
+16 -1 cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+14 -2 cfe/trunk/unittests/Format/FormatTest.cpp
+30 -3 2 files

LLVM — cfe/trunk/lib/Format UnwrappedLineParser.cpp

Reformat formatter code. No functionality change.
Delta File
+9 -10 cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+9 -10 1 file

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp TokenAnnotator.h, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Detect ObjC array literals.

Use this to add a space after "@[" and before "]" for now.

Later, I want to use this to format multi-line array literals nicer, too.
Delta File
+11 -4 cfe/trunk/lib/Format/TokenAnnotator.cpp
+6 -1 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -1 cfe/trunk/lib/Format/TokenAnnotator.h
+19 -6 3 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Add test for default arguments.
Delta File
+2 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -0 1 file

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Move ObjC literal tests to its own test case.

Slightly expand the boxed expressions test with a few more snippets from
http://clang.llvm.org/docs/ObjectiveCLiterals.html
Delta File
+21 -13 cfe/trunk/unittests/Format/FormatTest.cpp
+21 -13 1 file

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Correctly detect ObjC message expressions preceded by a comment.
Delta File
+14 -11 cfe/trunk/lib/Format/TokenAnnotator.cpp
+6 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+20 -11 2 files

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: No space after & and * in front of ObjC message expressions.

1. let determineStarAmp() check of unary operators before checking for
   "is next '['". That check was added in r173150, and the test from that
   revision passes either way.

2. change determineStarAmp() to categorize '*' and '&' after '=' as unary
   operator.

3. don't let parseSquare() overwrite the type of a '*' or '&' before the start
   of an objc message expression if has the role of unary operator.
Delta File
+10 -6 cfe/trunk/lib/Format/TokenAnnotator.cpp
+2 -3 cfe/trunk/unittests/Format/FormatTest.cpp
+12 -9 2 files

LLVM — cfe/trunk/lib/Format TokenAnnotator.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Detect ObjC method expressions after unary operators.
Delta File
+20 -6 cfe/trunk/lib/Format/TokenAnnotator.cpp
+16 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+36 -6 2 files

LLVM — cfe/trunk/lib/AST Decl.cpp, cfe/trunk/test/SemaCXX sourceranges.cpp

Fix a bug in VarDecl::getSourceRange() for static member arrays with an element
type with an implicit initializer expression.

Patch from Will Wilson <will at indefiant.com>!
Delta File
+4 -1 cfe/trunk/test/SemaCXX/sourceranges.cpp
+3 -1 cfe/trunk/lib/AST/Decl.cpp
+7 -2 2 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Remove a fixme klimek fixed in r173168.

Add a few comments to the ObjC test cases.
Delta File
+2 -3 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -3 1 file

LLVM — cfe/trunk/lib/Format Format.cpp

Formatter: Set MatchingParen for [], to match <>, (), {}. No functionality change.
Delta File
+2 -0 cfe/trunk/lib/Format/Format.cpp
+2 -0 1 file

LLVM — cfe/trunk/lib/Format Format.cpp

Formatter: Rename LSquare to Left to make parseSquare() more consistent with the other 
paren parsing methods.
Delta File
+6 -8 cfe/trunk/lib/Format/Format.cpp
+6 -8 1 file

LLVM — cfe/trunk/lib/Parse ParseDeclCXX.cpp, cfe/trunk/test/Parser cxx-decl.cpp

Fix parsing of class specifiers before '\n' 'operator'.

r159549 / r159164 regressed clang to reject

  struct s {};
  struct s
  operator++(struct s a)
  { return a; }

This fixes the regression. Richard, pleas check if this looks right.
Delta File
+18 -0 cfe/trunk/test/Parser/cxx-decl.cpp
+1 -0 cfe/trunk/lib/Parse/ParseDeclCXX.cpp
+19 -0 2 files

LLVM — cfe/trunk/lib/Format Format.cpp UnwrappedLineParser.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: After case blocks, "break" goes on the same line as the "}", PR14907.

Before:
switch (foo) {
case a: {
  int a = g();
  h(a);
}
  break;
}

Now:
switch (foo) {
case a: {
  int a = g();
  h(a);
} break;
}
Delta File
+26 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -2 cfe/trunk/lib/Format/Format.cpp
+2 -0 cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+30 -2 3 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Enable @encode test.

This doesn't work right with pointers to pointers, but that's likely just a
dupe of PR14884.
Delta File
+3 -1 cfe/trunk/unittests/Format/FormatTest.cpp
+3 -1 1 file

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: The contents of @selector() should be formatted as a selector.

Before: @selector(foo: )
Now: @selector(foo:)
Delta File
+43 -10 cfe/trunk/lib/Format/Format.cpp
+3 -3 cfe/trunk/unittests/Format/FormatTest.cpp
+46 -13 2 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Get bit tests in ifs right.

It's generally not possible to know if 'a' '*' 'b' is a multiplication
expression or a variable declaration with a purely lexer-based approach. The
formatter currently uses a heuristic that classifies this token sequence as a
multiplication in rhs contexts (after '=' or 'return') and as a declaration
else.

Because of this, it gets bit tests in ifs, such as "if (a & b)" wrong. However,
declarations in ifs always have to be followed by '=', so this patch changes
the formatter to classify '&' as an operator if it's at the start of an if
statement.

Before:
  if (a& b)
  if (int* b = f())

Now:
  if (a & b)
  if (int* b = f())
Delta File
+24 -1 cfe/trunk/lib/Format/Format.cpp
+8 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+32 -1 2 files

LLVM — cfe/trunk/include/clang/Format Format.h, cfe/trunk/lib/Format Format.cpp

Revert most of r172140.

r172140 changed the formatter to produce "-(id) foo" instead of "- (id)foo"
in google style, with a link to
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions
as reference.  But now that I look at that link again, it seems I didn't
read it very carefully the first time round.
Delta File
+7 -7 cfe/trunk/unittests/Format/FormatTest.cpp
+1 -12 cfe/trunk/lib/Format/Format.cpp
+0 -4 cfe/trunk/include/clang/Format/Format.h
+8 -23 3 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Add a test for bitfields.

They work fine, but this fifth use of colons (after labels, in ?:,
in initalizer lists in constructors, in objc method expressions, and in
bitfields) wasn't covered by tests yet.
Delta File
+7 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+7 -0 1 file

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Don't insert a space before unary operators after selector names.

Before:
  [color getRed: &r green: &g blue: &b alpha: &a];

Now:
  [color getRed:&r green:&g blue:&b alpha:&a];
Delta File
+3 -2 cfe/trunk/lib/Format/Format.cpp
+1 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+4 -2 2 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Add a test for @selector in an ObjC method expression, which happens to work 
already.
Delta File
+1 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+1 -0 1 file

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Remove debugging junk I accidentally landed in r172333.
Delta File
+0 -3 cfe/trunk/unittests/Format/FormatTest.cpp
+1 -1 cfe/trunk/lib/Format/Format.cpp
+1 -4 2 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Prefer breaking before ObjC selector names over breaking at their ':'

Before:
  if ((self = [super initWithContentRect:contentRect styleMask:
                  styleMask backing:NSBackingStoreBuffered defer:YES])) {

Now:
  if ((self = [super initWithContentRect:contentRect styleMask:styleMask
                  backing:NSBackingStoreBuffered defer:YES])) {
Delta File
+20 -1 cfe/trunk/lib/Format/Format.cpp
+11 -4 cfe/trunk/unittests/Format/FormatTest.cpp
+31 -5 2 files

LLVM — cfe/trunk/lib/Format Format.cpp

Formatter: Remove an always-false condition.

canBreakBefore() does not allow breaking after ':' for LT_ObjCMethodDecl lines,
so if Newline is true in addTokenToState() for ':' then LT_ObjCMethodDecl
cannot be set. No functionality change.
Delta File
+1 -2 cfe/trunk/lib/Format/Format.cpp
+1 -2 1 file

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Remove a redundant CurrentLineType check.

The containing if checks for this already. No functionality change.
Delta File
+2 -2 cfe/trunk/lib/Format/Format.cpp
+0 -1 cfe/trunk/unittests/Format/FormatTest.cpp
+2 -3 2 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Initial support for formatting Objective-C method expressions.        
                                                                                 
This follows the approach suggested by djasper in PR14911: When a '[' is         
seen that's at the start of a line, follows a binary operator, or follows one    
of : [ ( return throw, that '[' and its closing ']' are marked as
TT_ObjCMethodExpr and every ':' in that range that isn't part of a ternary
?: is marked as TT_ObjCMethodExpr as well.

Update the layout routines to not output spaces around ':' tokens that are
marked TT_ObjCMethodExpr, and only allow breaking after such tokens, not
before.

Before:
    [self adjustButton : closeButton_ ofKind : NSWindowCloseButton];

Now:
    [self adjustButton:closeButton_ ofKind:NSWindowCloseButton];
Delta File
+61 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+48 -6 cfe/trunk/lib/Format/Format.cpp
+109 -6 2 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: * and & are binary operators before ( and [.
Delta File
+3 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+1 -0 cfe/trunk/lib/Format/Format.cpp
+4 -0 2 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: * and & are binary operators after ) and ].
Delta File
+2 -1 cfe/trunk/lib/Format/Format.cpp
+2 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+4 -1 2 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: + and - after { are unary operators.
Delta File
+3 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+1 -1 cfe/trunk/lib/Format/Format.cpp
+4 -1 2 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: add a test for :? in []
Delta File
+7 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+7 -0 1 file

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Format ObjC static and instance methods consistently, add a test for that.
Delta File
+3 -2 cfe/trunk/lib/Format/Format.cpp
+4 -0 cfe/trunk/unittests/Format/FormatTest.cpp
+7 -2 2 files

LLVM — cfe/trunk/unittests/Format FormatTest.cpp

Formatter: Remove a fixme, Jordy says @synthesize is good as is.
Delta File
+0 -3 cfe/trunk/unittests/Format/FormatTest.cpp
+0 -3 1 file

LLVM — cfe/trunk/include/clang/Format Format.h, cfe/trunk/lib/Format Format.cpp

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
Delta File
+20 -7 cfe/trunk/lib/Format/Format.cpp
+14 -7 cfe/trunk/unittests/Format/FormatTest.cpp
+4 -0 cfe/trunk/include/clang/Format/Format.h
+38 -14 3 files

LLVM — cfe/trunk/lib/Format Format.cpp, cfe/trunk/unittests/Format FormatTest.cpp

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).
Delta File
+12 -1 cfe/trunk/lib/Format/Format.cpp
+7 -2 cfe/trunk/unittests/Format/FormatTest.cpp
+19 -3 2 files

LLVM — cfe/trunk/include/clang/Format Format.h

Formatter: Land header change I forgot to land in r172099.
Delta File
+4 -0 cfe/trunk/include/clang/Format/Format.h
+4 -0 1 file