Граф коммитов

42338 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek e22cef5cb2 Note that checker-271 is newer than the analyzer in Xcode 4.6
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174759 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 22:19:43 +00:00
Ted Kremenek 8580c7e752 Update open source checker build to checker-271.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174758 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 22:18:26 +00:00
Douglas Gregor 2d1ece81a5 Always keep highest identifier, selector, and macro IDs when we've
read another one, just as we do for types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174745 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 21:30:59 +00:00
Douglas Gregor ea14a8799f Never cache the result of a module file lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174744 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 21:27:45 +00:00
Manuel Klimek 52635ff9fb 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;'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174737 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 19:53:32 +00:00
Ted Kremenek 8185674528 Teach BugReporter (extensive diagnostics) to emit a diagnostic when a loop body is skipped.
Fixes <rdar://problem/12322528>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174736 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 19:51:43 +00:00
Argyrios Kyrtzidis 5a56e1bdfb [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174734 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 19:27:23 +00:00
Ted Kremenek 19df705c75 Remove stale instance variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 18:59:17 +00:00
Fariborz Jahanian 9ffd1aea98 objective-C modern translation: Fix another random translation bug
involving property getter expressions on rhs of property setter.
// rdar://13138459


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174729 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 18:57:50 +00:00
Manuel Klimek 547d5db5ed Takes the context into account when re-indenting regions.
Fixes llvm.org/PR14916.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174720 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 17:38:27 +00:00
Fariborz Jahanian bfaa111e71 objective-C modern translator. Fixes a trivial
rewriting bug where #ifdef ended up on the same
line as the attribute declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 17:15:07 +00:00
Daniel Jasper 087387a1e9 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);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174718 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 16:49:27 +00:00
Daniel Jasper 29f123b2fa 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 15:28:42 +00:00
Daniel Jasper ce3d1a68d9 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];

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174701 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 08:22:00 +00:00
Tim Northover 026ce82649 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174700 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 08:00:13 +00:00
Jordan Rose 6bbaa77251 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174698 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 07:28:25 +00:00
Nick Lewycky 63eb156f66 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174694 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 02:38:30 +00:00
Jordan Rose 3092d9da06 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174691 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 01:42:37 +00:00
Richard Smith a69a58991f Fix conflict between r174685 and r174645 (rename -fmodule-cache-path <foo> to -fmodules-cache-path=<foo>).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174690 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 01:35:44 +00:00
Argyrios Kyrtzidis a86b37e223 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174689 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 01:12:25 +00:00
Tanya Lattner f21107b95a Use the target address space value when mangling names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174688 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 01:07:32 +00:00
Richard Smith 2bb07c1dfe 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174685 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 00:37:45 +00:00
Fariborz Jahanian ada7191795 objective-C modern translator. Generate #line
info in the translated code under -g only.
// rdar://13138170


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174684 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 00:27:34 +00:00
Douglas Gregor 1b58c74af2 Teach subframework header lookup to suggest modules <rdar://problem/13176200>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174683 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 00:10:48 +00:00
Anna Zaks 8135886ab7 [analyzer] Remove redundant check as per Jordan's feedback.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174680 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 23:29:22 +00:00
Anna Zaks 1c32b81765 [analyzer] Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 23:29:20 +00:00
Anna Zaks 118aa750c5 [analyzer] Report bugs when freeing memory with offset pointer
The malloc checker will now catch the case when a previously malloc'ed
region is freed, but the pointer passed to free does not point to the
start of the allocated memory. For example:

int *p1 = malloc(sizeof(int));
p1++;
free(p1); // warn

From the "memory.LeakPtrValChanged enhancement to unix.Malloc" entry
in the list of potential checkers.

A patch by Branden Archer!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174678 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 23:05:47 +00:00
Anna Zaks 233e26acc0 [analyzer] Add pointer escape type param to checkPointerEscape callback
The checkPointerEscape callback previously did not specify how a
pointer escaped. This change includes an enum which describes the
different ways a pointer may escape. This enum is passed to the
checkPointerEscape callback when a pointer escapes. If the escape
is due to a function call, the call is passed. This changes
previous behavior where the call is passed as NULL if the escape
was due to indirectly invalidating the region the pointer referenced.

A patch by Branden Archer!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174677 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 23:05:43 +00:00
Anna Zaks 2b6876173b [analyzer] Don't reinitialize static globals more than once along a path
This patch makes sure that we do not reinitialize static globals when
the function is called more than once along a path. The motivation is
code with initialization patterns that rely on 2 static variables, where
one of them has an initializer while the other does not. Currently, we
reset the static variables with initializers on every visit to the
function along a path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174676 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 23:05:37 +00:00
Douglas Gregor 250172a851 Form the default -fmodules-cache-path= properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174674 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 22:59:12 +00:00
Fariborz Jahanian 31c4a4b017 objective-C modern translator. More fixups for
modern meta-data abi translation. Still wip.
// rdar://13138459


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174672 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 22:50:40 +00:00
Daniel Jasper daf1a15d73 clang-format: Don't put useless space in f( ::g()).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174662 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 21:08:36 +00:00
Douglas Gregor 882090e76a Add missing header from r174648
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174649 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 19:15:44 +00:00
Douglas Gregor 7666b03d49 Retain all hidden methods in the global method pool, because they may become visible <rdar://problem/13172858>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174648 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 19:13:24 +00:00
Dmitri Gribenko 90b5ac660e libclang: reduce CXString abuse
ContainerUSR is not really a CXString, but it should own the underlying memory
buffer.  Thus, it is better to change the type to std::string.  This will not
introduce extra copying overhead, since the workaround that is being removed
was already making a copy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174647 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 19:09:22 +00:00
Douglas Gregor 953a61f26b Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174645 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 19:01:24 +00:00
DeLesley Hutchins ed4330bc15 Thread safety analysis: make sure that expressions in attributes are parsed
in an unevaluated context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174644 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 19:01:07 +00:00
Chad Rosier b30c038202 Testcase for r174477.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174640 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 18:32:25 +00:00
Guy Benyei 6959acd4bb Enable overloading of OpenCL events - this is needed for the overloaded OpenCL builtin functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174630 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 16:05:33 +00:00
Tim Northover 51dbecf89c FileCheckize volatile test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:39:16 +00:00
Tim Northover e8d3cf009f Only check for volatile memcpys in test.
AArch64 handles aggFct's return struct slightly differently, leading
to an extra memcpy. This test is fortunately only concerned about
volatile copies, so we can modify the grep text to filter it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:11:48 +00:00
Tim Northover 5024bf501a Add AArch64 wchar definition to test
This should allow it to pass if the default triple is AArch64

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174620 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:11:44 +00:00
Tim Northover 8fa36ea24e XFAIL test that's inappropriate for AArch64 ABI
Only some ABIs require the "signext" attribute on parameters. On most
platforms, however, it's a useful test so it's best not to limit it to some
random arbitrary platform.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174619 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:11:40 +00:00
Tim Northover 55f05937a2 Permit ABIs where the caller extends the result (test change).
This test was written to make sure *something* sane is generated, not
to test any ABI's signedness semantics.

This should allow the test to pass if AArch64 is the default target.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174618 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:11:36 +00:00
Dmitri Gribenko cbe50ccea2 Documentation: fix typo: stdard -> stdarg
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174613 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 14:48:33 +00:00
Dmitri Gribenko 1142b2aa6c Documentation: add information about builtin includes to FAQ
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174612 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 14:36:37 +00:00
NAKAMURA Takumi 775bb8a4ae libclang: CursorVisitor::VisitBuiltinTypeLoc(): Add OCLSampler. [-Wswitch]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 12:47:42 +00:00
Manuel Klimek fa37c5ca61 Implements equalsNode for Decl and Stmt.
This is a powerful tool when doing iterative refined matches,
where another match is started inside the match callback of the first
one; this allows for example to find out whether the node was in
the condition or body of its parent if-statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174605 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 12:42:10 +00:00
Guy Benyei 21f18c4fda Add OpenCL samplers as Clang builtin types and check sampler related restrictions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 10:55:47 +00:00
Nick Lewycky f5a6aefa37 Apply the pure-virtual odr rule to other constructs which can call overloaded
operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 05:08:22 +00:00