Commit Graph

43590 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 962b2210cc [preprocessing record] Add some sanity checks for the preprocessed entity index
to make sure we don't crash on release if the index is not valid.

rdar://13089714

llvm-svn: 175010
2013-02-12 21:41:23 +00:00
Chad Rosier 3ea602cd30 [ms-inline-asm] Add test cases for the align/emit directives.
Part of rdar://13200215

llvm-svn: 175009
2013-02-12 21:34:14 +00:00
Dmitri Gribenko 4e472b6328 Add a test for r174980, that we used to accept
llvm-svn: 175005
2013-02-12 20:43:41 +00:00
Daniel Jasper f52ab8d60c Fix crash for incomplete labels in macros.
Still the formatting can be improved, but at least we don't assert any
more. This happened when trying to format lib/Sema/SemaType.cpp.

llvm-svn: 175003
2013-02-12 20:17:17 +00:00
Chad Rosier 868d668e78 [ms-inline asm] Update test case now that we are correctly parsing __emit directives.
llvm-svn: 175000
2013-02-12 19:42:57 +00:00
Aaron Ballman 396088cdb5 Fixing the MSVC compiler warning a different way; removed use of static_cast and instead used a signed integer parameter.
llvm-svn: 174996
2013-02-12 19:20:48 +00:00
Chad Rosier e348d2724a Typo.
llvm-svn: 174995
2013-02-12 19:15:05 +00:00
Chad Rosier e90add40a9 [ms-inline asm] Add a few test cases for the parsing of hexidecimal integers.
llvm-svn: 174989
2013-02-12 18:45:21 +00:00
Aaron Ballman cd9e4e6063 Removing a signed/unsigned mismatch warning triggered in MSVC 11.
llvm-svn: 174986
2013-02-12 18:39:15 +00:00
Dmitri Gribenko d1c91f1763 Accept over-qualified constructor in MSVC emulation mode
MSVC accepts this:

class A {
  A::A();
};

Clang accepts regular member functions with extra qualification as an MS
extension, but not constructors.  This changes the parser to defer rejecting
qualified constructors so that the same Sema logic can apply to constructors as
regular member functions.  This also improves the error message when MS
extensions are disabled (in my opinion). Before it was:

/Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers
  A::A();
  ~~~~ ^
1 error generated.

After:

/Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A'
  A::A();
  ~~~^
1 error generated.

Patch by Jason Haslam.

llvm-svn: 174980
2013-02-12 17:27:41 +00:00
Daniel Jasper 2204562acd Fix bug in the adjustment to existing lines.
Before (if only the second line was reformatted):
void f() {}
          void g() {}

After:
void f() {}
void g() {}

llvm-svn: 174978
2013-02-12 16:51:23 +00:00
Nico Weber 4444917f5c 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.

Review URL: http://llvm-reviews.chandlerc.com/D384

llvm-svn: 174975
2013-02-12 16:17:07 +00:00
Edwin Vane e9dd3608ea Adding more overloads for allOf matcher
Adding overloads of allOf accepting 4 and 5 arguments.
    
Reviewer: klimek

llvm-svn: 174967
2013-02-12 13:55:40 +00:00
Timur Iskhodzhanov 584248cf3c Rename -constructors test to just -structors as in fact it tests dtors too. Also, fix a minor typo in the test.
llvm-svn: 174966
2013-02-12 13:22:47 +00:00
Nick Lewycky 94477cb084 Attempt to fix this test on i686 targets.
llvm-svn: 174953
2013-02-12 08:59:01 +00:00
Nick Lewycky a096b14d1d The meat of this patch is in BuildCXXMemberCalLExpr where we make it use
MarkMemberReferenced instead of marking functions referenced directly. An audit
of callers to MarkFunctionReferenced and DiagnoseUseOfDecl also caused a few
other changes:
 * don't mark functions odr-used when considering them for an initialization
   sequence. Do mark them referenced though.
 * the function nominated by the cleanup attribute should be diagnosed.
 * operator new/delete should be diagnosed when building a 'new' expression.

llvm-svn: 174951
2013-02-12 08:08:54 +00:00
John McCall 3d1e2c960d Properly assemble PHIs after a null-checked invoke of objc_msgSend.
rdar://12046763

llvm-svn: 174946
2013-02-12 05:53:35 +00:00
Richard Smith 8858159fb5 Fix a bug reduced from a crash when trying to use modules with libc++. We check
the linkage of functions and variables while merging declarations from modules,
and we don't necessarily have enough of the rest of the AST loaded at that
point to allow us to compute linkage, so serialize it instead.

llvm-svn: 174943
2013-02-12 05:48:23 +00:00
Anton Yartsev 277775b8af + specified progress information
llvm-svn: 174942
2013-02-12 05:02:54 +00:00
Anton Yartsev 19802a709a + centered progress cells
+ added progress information for several checkers

llvm-svn: 174941
2013-02-12 04:45:48 +00:00
John McCall e142ad50f1 Call __cxa_begin_catch with the current exception before
calling std::terminate().  rdar://11904428

llvm-svn: 174940
2013-02-12 03:51:46 +00:00
John McCall 2c33ba8cae Change some CGF parameters to CGMs.
llvm-svn: 174939
2013-02-12 03:51:38 +00:00
Richard Smith a00399c949 Remove an assert which triggers when a decl context in a module hits the 'has
lexical storage but not visible storage' case in C++. It's unclear whether we
even need the special-case handling for C++, since it seems to be working
around our not serializing a lookup table for the TU in C. But in any case,
the assertion is incorrect.

llvm-svn: 174931
2013-02-12 02:32:35 +00:00
John McCall 587b348504 Perform placeholder conversions on the controller of a _Generic
expression.

llvm-svn: 174930
2013-02-12 02:08:12 +00:00
John McCall 6ced97aaae Diagnose loads of 'half' l-values in OpenCL.
Patch by Joey Gouly!

llvm-svn: 174928
2013-02-12 01:29:43 +00:00
Lang Hames 697b004219 Backing out r174919 while I investigate a self-host bug on Takumi's builder.
llvm-svn: 174925
2013-02-12 00:44:43 +00:00
John McCall d21cdd4947 In ARC, emit non-peepholed +1s within the full-expression instead
of immediately afterwards.

llvm-svn: 174922
2013-02-12 00:25:08 +00:00
John McCall 8e24e861be Split a couple of tests out into their own file.
llvm-svn: 174921
2013-02-12 00:25:02 +00:00
Lang Hames 5824a4f1b0 When generating IR for default copy-constructors, copy-assignment operators,
move-constructors and move-assignment operators, use memcpy to copy adjacent
POD members.

Previously, classes with one or more Non-POD members would fall back on
element-wise copies for all members, including POD members. This often
generated a lot of IR. Without padding metadata, it wasn't often possible
for the LLVM optimizers to turn the element-wise copies into a memcpy.

This code hasn't yet received any serious tuning. I didn't see any serious
regressions on a self-hosted clang build, or any of the nightly tests, but
I think it's important to get this out in the wild to get more testing.
Insights, feedback and comments welcome.

Many thanks to David Blaikie, Richard Smith, and especially John McCall for
their help and feedback on this work.

llvm-svn: 174919
2013-02-11 23:44:11 +00:00
Tanya Lattner d7fe06f274 Timing data was removed years ago. Remove these links.
llvm-svn: 174918
2013-02-11 23:32:10 +00:00
Richard Smith 86a12015ee Don't bother reconciling external visible decls against our current set of
declarations if we didn't have a lookup map when the external decls were added.

llvm-svn: 174906
2013-02-11 22:02:16 +00:00
Fariborz Jahanian b0fdab26d1 objective-C modern translator: Fixes a mistranslation
of @throw statement by finding location of the ';'
correctly. // rdar://13186010

llvm-svn: 174898
2013-02-11 19:30:33 +00:00
Douglas Gregor dcf2508791 [Modules] Cope better with top-level declarations loaded after being declared in the current translation unit <rdar://problem/13189985>.
These two related tweaks to keep the information associated with a
given identifier correct when the identifier has been given some
top-level information (say, a top-level declaration) and more
information is then loaded from a module. The first ensures that an
identifier that was "interesting" before being loaded from an AST is
considered to be different from its on-disk counterpart. Otherwise, we
lose such changes when writing the current translation unit as a
module.

Second, teach the code that injects AST-loaded names into the
identifier chain for name lookup to keep the most recent declaration,
so that we don't end up confusing our declaration chains by having a
different declaration in there.

llvm-svn: 174895
2013-02-11 18:16:18 +00:00
Nico Weber 29f9dea1ab 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.

llvm-svn: 174889
2013-02-11 15:32:15 +00:00
Manuel Klimek 2549956ee3 Get rid of manual debug output, now that the test runner supports it.
You can run tests with -debug instead now.

llvm-svn: 174880
2013-02-11 12:37:30 +00:00
Daniel Jasper eef30490fd Fix invalid formatting with spaces before trailing comments.
In google style, trailing comments are separated by two spaces. This
patch fixes the counting of these spaces and prevents clang-format from
creating a line with 81 columns.

llvm-svn: 174879
2013-02-11 12:36:37 +00:00
Manuel Klimek 0c13795f68 Fixes handling of empty lines in macros.
Now correctly formats:
 #define A \
   \
   b;
to
 #define A b;

Added the state whether an unwrapped line is a macro to the debug
output.

llvm-svn: 174878
2013-02-11 12:33:24 +00:00
Bill Wendling 832d3c2fac Update test to not fail with attribute groups.
llvm-svn: 174866
2013-02-11 08:35:52 +00:00
Daniel Jasper 35d2dc765e Fix formatting of overloaded operator definitions.
Before:
operatorvoid*();
operator vector< A< A>>();

After:
operator void *();
operator vector<A<A> >();

llvm-svn: 174863
2013-02-11 08:01:18 +00:00
Manuel Klimek ca846ae622 Do not use VariadicDynCastAllOfMatcher where VariadicAllOfMatcher works.
llvm-svn: 174862
2013-02-11 07:45:01 +00:00
Nico Weber da2b868f1e 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.

llvm-svn: 174843
2013-02-10 21:08:31 +00:00
Nico Weber 0448b4dd87 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.

llvm-svn: 174842
2013-02-10 20:48:24 +00:00
Nico Weber 33c68e900b Formatter: Add another ObjC literal test.
(From http://clang.llvm.org/docs/ObjectiveCLiterals.html.)

llvm-svn: 174841
2013-02-10 20:39:05 +00:00
Nico Weber 372d8dcf15 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.

llvm-svn: 174840
2013-02-10 20:35:35 +00:00
Bob Wilson 2616e2ec85 Use -mno-implicit-float by default for kernel/kext code. <rdar://13177960>
Apple's kernel engineers have been expecting this behavior even though
we've never implemented it before, as far as I can tell. In recent months,
clang has gotten better at using vector instructions to optimize memcpy-like
operations, and that has exposed problems when vector/floating-point
instructions are used in kexts that don't support that. This behavior also
matches what Apple's GCC did for PowerPC targets.

llvm-svn: 174838
2013-02-10 16:01:41 +00:00
Bob Wilson dc9e6085c4 Delete an extra blank line.
llvm-svn: 174837
2013-02-10 16:01:38 +00:00
Bob Wilson 2cc9690f5e Recognize -mno-implicit-float option for x86 as well as ARM. <rdar://13180731>
For x86 targets, we've been using the -msoft-float option to control passing
the no-implicit-float option to cc1. Since the -mno-implicit-float option is
now accepted by the driver, this just makes it work for x86 the same as it
does for ARM targets.

llvm-svn: 174836
2013-02-10 15:25:44 +00:00
Dmitri Gribenko 74f4d0287f Use static functions instead of an unnamed namespace
llvm-svn: 174835
2013-02-10 11:54:22 +00:00
Nico Weber 67ffb338ee Reformat formatter code. No functionality change.
llvm-svn: 174823
2013-02-10 04:38:23 +00:00
Nico Weber 2a726b6c34 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.

llvm-svn: 174822
2013-02-10 02:08:05 +00:00
Fariborz Jahanian 234c00d6d0 objective-C: Fixes a bogus warning due to not setting
the "nonatomic" attribute in property redeclaration
in class extension. Also, improved on diagnostics in
this area while at it. // rdar://13156292

llvm-svn: 174821
2013-02-10 00:16:04 +00:00
Nico Weber 06fcec1cf9 Formatter: Add test for default arguments.
llvm-svn: 174816
2013-02-09 18:02:07 +00:00
Dmitri Gribenko 4b8a84fdca FileCheck'ize tests
llvm-svn: 174815
2013-02-09 16:41:47 +00:00
Dmitri Gribenko f37d0cd780 FileCheck'ize a test
llvm-svn: 174814
2013-02-09 16:25:38 +00:00
Dmitri Gribenko f340008eab Remove unreachable statement
llvm-svn: 174811
2013-02-09 15:24:28 +00:00
Dmitri Gribenko bcef3411cd Comment parsing: use CharInfo.h
This also gives us 0.2% speedup on '-fsyntax-only -Wdocumentation' time for
a testcase that consists of all Clang headers.

llvm-svn: 174810
2013-02-09 15:16:58 +00:00
Dmitri Gribenko efbbd1e90c libclang: use CXCursor getters to simplify code
llvm-svn: 174809
2013-02-09 14:12:09 +00:00
Jordan Rose 4938f276a5 Remove some stray uses of <ctype.h> functions.
These are causing assertions on some MSVC builds.

llvm-svn: 174805
2013-02-09 10:09:43 +00:00
Ted Kremenek 7ee25676a5 QoI: -Wreadonly-iboutlet-property should have the warning's location on the property.
There's no need to refer to the @implementation at all.

Fixes <rdar://problem/13186515>

llvm-svn: 174802
2013-02-09 07:13:16 +00:00
Jordan Rose d9759fdb03 Release notes: mention support for Unicode and UCNs in identifiers.
I'm using the name "Extended Identifiers" for the feature because that's
what GCC calls them. According to the standard, the new feature is
"universal character names are now allowed in identifiers", but the more
interesting "feature" is that identifiers can now contain Unicode characters,
however they are written.

llvm-svn: 174798
2013-02-09 02:12:23 +00:00
Douglas Gregor 7dab26b87c Ensure that type definitions present in just-loaded modules are
visible.

The basic problem here is that a given translation unit can use
forward declarations to form pointers to a given type, say,

  class X;
  X *x;

and then import a module that includes a definition of X:

  import XDef;

We will then fail when attempting to access a member of X, e.g., 

  x->method()

because the AST reader did not know to look for a default of a class
named X within the new module.

This implementation is a bit of a C-centric hack, because the only
definitions that can have this property are enums, structs, unions,
Objective-C classes, and Objective-C protocols, and all of those are
either visible at the top-level or can't be defined later. Hence, we
can use the out-of-date-ness of the name and the identifier-update
mechanism to force the update.

In C++, we will not be so lucky, and will need a more advanced
solution, because the definitions could be in namespaces defined in
two different modules, e.g.,

  // module 1
  namespace N { struct X; }

  // module 2
  namespace N { struct X { /* ... */ }; }

One possible implementation here is for C++ to extend the information
associated with each identifier table to include the declaration IDs
of any definitions associated with that name, regardless of
context. We would have to eagerly load those definitions.

llvm-svn: 174794
2013-02-09 01:35:03 +00:00
NAKAMURA Takumi 1aa79e9f63 clang/lib/StaticAnalyzer/Core/BugReporter.cpp: Appease old msvc in std::pair(0, 0).
llvm-svn: 174792
2013-02-09 01:22:23 +00:00
Jordan Rose 58c61e006f Properly validate UCNs for C99 and C++03 (both more restrictive than C(++)11).
Add warnings under -Wc++11-compat, -Wc++98-compat, and -Wc99-compat when a
particular UCN is incompatible with a different standard, and -Wunicode when
a UCN refers to a surrogate character in C++03.

llvm-svn: 174788
2013-02-09 01:10:25 +00:00
Anna Zaks 7811c3efd5 [analyzer] Invalidation checker: move the "missing implementation" check
The missing definition check should be in the same category as the
missing ivar validation - in this case, the intent is to invalidate in
the given class, as described in the declaration, but the implementation
does not perform the invalidation. Whereas the MissingInvalidationMethod
checker checks the cases where the method intention is not to
invalidate. The second checker has potential to have a much higher false
positive rate.

llvm-svn: 174787
2013-02-09 01:09:27 +00:00
Anna Zaks 0d8779cb79 [analyzer] Move DefaultBool so that all checkers can share it.
llvm-svn: 174782
2013-02-08 23:55:50 +00:00
Anna Zaks 91a5fdf83a [analyzer] Split IvarInvalidation into two checkers
Separate the checking for the missing invalidation methods into a
separate checker so that it can be turned on/off independently.

llvm-svn: 174781
2013-02-08 23:55:47 +00:00
Anna Zaks 470543bb2b [analyzer] IvarInvalidation: refactor, pull out the diagnostic printing
llvm-svn: 174780
2013-02-08 23:55:45 +00:00
Anna Zaks a5096f6f51 [analyzer] IvarInvalidation: add annotation for partial invalidation
The new annotation allows having methods that only partially invalidate
IVars and might not be called from the invalidation methods directly
(instead, are guaranteed to be called before the invalidation occurs).
The checker is going to trust the programmer to call the partial
invalidation method before the invalidator.This is common in cases when
partial object tear down happens before the death of the object.

llvm-svn: 174779
2013-02-08 23:55:43 +00:00
Fariborz Jahanian f3c171ebec objective-C: don't issue bogus warning about
"auto-synthesized may not work correctly with 'nib' loader"
when 'readonly' property is redeclared 'readwrite' in class
extension. // rdar://13123861

llvm-svn: 174775
2013-02-08 23:32:30 +00:00
Jordan Rose 388d767ab1 CharInfo: Add missing "using namespace clang::charinfo" in .cpp file.
Should fix the MSC bot.

llvm-svn: 174769
2013-02-08 22:37:49 +00:00
Jordan Rose a7d03840e6 Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

llvm-svn: 174768
2013-02-08 22:30:41 +00:00
Jordan Rose a08ed5965c Simplify logic for avoiding concatenation after numeric constants.
I threw in a couple of test cases for UD-suffixes -- already working, but
it wasn't immediately obvious to me.

llvm-svn: 174767
2013-02-08 22:30:31 +00:00
Jordan Rose 00d1b59184 StmtPrinter: Write large char values using \u or \U.
This may not always be valid, but we were previously just
emitting them raw.

While here, s/isprint/isPrintable/ (using the new CharInfo).

llvm-svn: 174766
2013-02-08 22:30:27 +00:00
Jordan Rose a2100d755a Pull Lexer's CharInfo table out for general use throughout Clang.
Rewriting the same predicates over and over again is bad for code size and
code maintainence. Using the functions in <ctype.h> is generally unsafe
unless they are specified to be locale-independent (i.e. only isdigit and
isxdigit).

The next commit will try to clean up uses of <ctype.h> functions within Clang.

llvm-svn: 174765
2013-02-08 22:30:22 +00:00
Ted Kremenek e0cdd752d5 Note that checker-271 is newer than the analyzer in Xcode 4.6
llvm-svn: 174759
2013-02-08 22:19:43 +00:00
Ted Kremenek b3cbef4ad2 Update open source checker build to checker-271.
llvm-svn: 174758
2013-02-08 22:18:26 +00:00
Douglas Gregor 8d7edced83 Always keep highest identifier, selector, and macro IDs when we've
read another one, just as we do for types.

llvm-svn: 174745
2013-02-08 21:30:59 +00:00
Douglas Gregor dadd85dc0c Never cache the result of a module file lookup.
llvm-svn: 174744
2013-02-08 21:27:45 +00:00
Manuel Klimek d076dcd54f Fix indentation-detection at indent level 0.
This correctly formats:
  {
    a;
  }
where { is incorrectly indented by 2, but is at level 0, when
reformatting only 'a;'.

llvm-svn: 174737
2013-02-08 19:53:32 +00:00
Ted Kremenek ca3ed7230d Teach BugReporter (extensive diagnostics) to emit a diagnostic when a loop body is skipped.
Fixes <rdar://problem/12322528>.

llvm-svn: 174736
2013-02-08 19:51:43 +00:00
Argyrios Kyrtzidis ba91ab65aa [libclang] Add a test to make sure annotation works fine in the presence of
'override' on the method.

This was fixed in a previous commit, generally handling attributes that are at the
end of the declaration.

rdar://13140589

llvm-svn: 174734
2013-02-08 19:27:23 +00:00
Ted Kremenek 20a43dc29c Remove stale instance variable.
llvm-svn: 174730
2013-02-08 18:59:17 +00:00
Fariborz Jahanian 4254cdb7ed objective-C modern translation: Fix another random translation bug
involving property getter expressions on rhs of property setter.
// rdar://13138459

llvm-svn: 174729
2013-02-08 18:57:50 +00:00
Manuel Klimek b95f5450a9 Takes the context into account when re-indenting regions.
Fixes llvm.org/PR14916.

llvm-svn: 174720
2013-02-08 17:38:27 +00:00
Fariborz Jahanian e8730a3558 objective-C modern translator. Fixes a trivial
rewriting bug where #ifdef ended up on the same
line as the attribute declaration.

llvm-svn: 174719
2013-02-08 17:15:07 +00:00
Daniel Jasper 8360a86c8c Fix handling of fake parenthesis during formatting.
They are much easier to handle when attached to the previous token.

Before:
unsigned Indent =
    formatFirstToken(TheLine.First, IndentForLevel[TheLine.Level] >=
                                    0 ? IndentForLevel[TheLine.Level]
: TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn);

After:
unsigned Indent = formatFirstToken(
    TheLine.First, IndentForLevel[TheLine.Level] >= 0
                       ? IndentForLevel[TheLine.Level] : TheLine.Level * 2,
    TheLine.InPPDirective, PreviousEndOfLineColumn);

llvm-svn: 174718
2013-02-08 16:49:27 +00:00
Daniel Jasper 400adc64da Implement a tiny expression parser to improve formatting decisions.
With this patch, the formatter introduces 'fake' parenthesis according
to the operator precedence of binary operators.

Before:
return aaaa & AAAAAAAAAAAAAAAAAAAAAAAAAAAAA || bbbb &
       BBBBBBBBBBBBBBBBBBBBBBBBBBBBB || cccc & CCCCCCCCCCCCCCCCCCCCCCCCCC ||
       dddd & DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;
f(aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa &&
  aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa);

After:
return aaaa & AAAAAAAAAAAAAAAAAAAAAAAAAAAAA ||
       bbbb & BBBBBBBBBBBBBBBBBBBBBBBBBBBBB ||
       cccc & CCCCCCCCCCCCCCCCCCCCCCCCCC ||
       dddd & DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD;
f(aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa,
  aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa,
  aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa);

Future improvements:
- Get rid of some of the hacky ways to nicely format certain constructs.
- Merge this parser and the AnnotatingParser as we now have several parsers
  that analyze (), [], etc.

llvm-svn: 174714
2013-02-08 15:28:42 +00:00
Daniel Jasper acc33666f6 Avoid unnecessary line breaks in nested ObjC calls.
Before:
  [pboard setData:[NSData dataWithBytes:&button
                                 length:sizeof(button)]
          forType:kBookmarkButtonDragType];
After:
  [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)]
          forType:kBookmarkButtonDragType];

llvm-svn: 174701
2013-02-08 08:22:00 +00:00
Tim Northover d3c543703d Improve filechecking of volatile test.
My previous attempt was extremely deficient, allowing more volatiles
to be introduced and not even checking all of the ones that are
present.

This attempt doesn't try to keep track of the values stored or offsets
within particular objects, just that the correct objects are accessed
in a correctly volatile manner throughout.

llvm-svn: 174700
2013-02-08 08:00:13 +00:00
Jordan Rose 08bf4fd345 CMake: Include Clang unit tests in check-clang target in standalone builds.
Also, remove CLANG_BUILD_TESTS option. It won't have consistent behavior
between standalone and non-standalone builds, so I'm not going to bother
hooking it up for standalone builds. LLVM_BUILD_TESTS will continue to
control unit test inclusion in the "all" target in non-standalone builds.

Finally, fix the default value of CLANG_INCLUDE_TESTS, which was being set
to the boolean value of "LLVM_INCLUDE_TESTS", i.e. OFF, rather than actually
reading the variable ${LLVM_INCLUDE_TESTS}! If you picked up my earlier
commit, YOU WILL HAVE TO MANUALLY SET THIS OPTION BACK ON. My apologies!

Part two of r174691 (allow the unit tests to be built in standalone mode).

llvm-svn: 174698
2013-02-08 07:28:25 +00:00
Nick Lewycky a245d3e1fc Fix test failure by making sure this file isn't identical to any other file
included in the same test. Clang gets confused about whether it's already built
a module for this file, when running on a content-addressible filesystem.

llvm-svn: 174694
2013-02-08 02:38:30 +00:00
Jordan Rose dfbe77cdf5 CMake: Optionally allow running the Clang unit tests in standalone builds.
The reason this is not enabled by default is because there is no way for
Clang to guarantee that the LLVM unit testing infrastruture has been built.
However, if it /has/ been built, there's no reason why the standalone Clang
build can't use it!

This should have no effect on existing builds -- in a combined build the
value of the CLANG_INCLUDE_TESTS option defaults to the LLVM equivalent,
and in a standalone build it defaults to off.

llvm-svn: 174691
2013-02-08 01:42:37 +00:00
Richard Smith 684f9687c7 Fix conflict between r174685 and r174645 (rename -fmodule-cache-path <foo> to -fmodules-cache-path=<foo>).
llvm-svn: 174690
2013-02-08 01:35:44 +00:00
Argyrios Kyrtzidis a2ed813afd [libclang] Attribute visitation happens out-of-source-order, make sure
we annotate properly when there is an attribute and not skip type specs
if the attribute is after the declaration.

rdar://13129077

llvm-svn: 174689
2013-02-08 01:12:25 +00:00
Tanya Lattner 60e93a6390 Use the target address space value when mangling names.
llvm-svn: 174688
2013-02-08 01:07:32 +00:00
Richard Smith 75fc3bf5fe Fix stack overflow and improve performance when a module contains many
overloads of a name by claiming that there are no lookup results for that name
in modules while loading the names from the module. Lookups in deserialization
really don't want to find names which they themselves are in the process of
introducing. This also has the pleasant side-effect of automatically caching
PCH lookups which found no names.

The runtime here is still quadratic in the number of overloads, but the
constant is lower.

llvm-svn: 174685
2013-02-08 00:37:45 +00:00
Fariborz Jahanian e4c7e855f1 objective-C modern translator. Generate #line
info in the translated code under -g only.
// rdar://13138170

llvm-svn: 174684
2013-02-08 00:27:34 +00:00
Douglas Gregor f5f9452808 Teach subframework header lookup to suggest modules <rdar://problem/13176200>.
llvm-svn: 174683
2013-02-08 00:10:48 +00:00
Anna Zaks 907e126be2 [analyzer] Remove redundant check as per Jordan's feedback.
llvm-svn: 174680
2013-02-07 23:29:22 +00:00
Anna Zaks 297176c393 [analyzer] Fix typo.
llvm-svn: 174679
2013-02-07 23:29:20 +00:00