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

42824 Коммитов

Автор SHA1 Сообщение Дата
Sean Silva 7298c0b14c [docs] Spelling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176421 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-03 17:07:35 +00:00
David Chisnall 72c1dba494 Improve C11 atomics support:
- Generate atomicrmw operations in most of the cases when it's sensible to do
  so.
- Don't crash in several common cases (and hopefully don't crash in more of
  them).
- Add some better tests.

We now generate significantly better code for things like:
_Atomic(int) x;
...
x++;

On MIPS, this now generates a 4-instruction ll/sc loop, where previously it
generated about 30 instructions in two nested loops.  On x86-64, we generate a
single lock incl, instead of a lock cmpxchgl loop (one instruction instead of
ten).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176420 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-03 16:02:42 +00:00
David Chisnall 5b9f5cc7c4 Default to enabling default-synthesized ivars on all platforms
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176419 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-03 15:36:10 +00:00
Sean Silva e7259ae90d [docs] Use vim code-block instead of console.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176418 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-03 15:17:35 +00:00
Rafael Espindola 65611bf036 Process #pragma weak only after we know the linkage of the function or variable
we are looking at.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176414 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 21:41:48 +00:00
Peter Collingbourne b88d9480e0 CommandLineArgumentParser: handle single quotes.
Differential Revision: http://llvm-reviews.chandlerc.com/D482

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176404 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 06:00:16 +00:00
Anna Zaks cc5dbdae70 [analyzer] Simple inline defensive checks suppression
Inlining brought a few "null pointer use" false positives, which occur because
the callee defensively checks if a pointer is NULL, whereas the caller knows
that the pointer cannot be NULL in the context of the given call.

This is a first attempt to silence these warnings by tracking the symbolic value
along the execution path in the BugReporter. The new visitor finds the node
in which the symbol was first constrained to NULL. If the node belongs to
a function on the active stack, the warning is reported, otherwise, it is
suppressed.

There are several areas for follow up work, for example:
 - How do we differentiate the cases where the first check is followed by
another one, which does happen on the active stack?

Also, this only silences a fraction of null pointer use warnings. For example, it
does not do anything for the cases where NULL was assigned inside a callee.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176402 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 03:20:52 +00:00
Fariborz Jahanian 8536fa14ee Some refactoring in my patch on document
command source fidelity. // rdar://13066276



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176401 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 02:39:57 +00:00
Peter Collingbourne 15e05e932c LLVM API changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176398 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 01:20:22 +00:00
Jordan Rose 549a292b54 CMake: -Wno-nested-anon-types for Clang.
In LLVM, -pedantic is not set unless LLVM_ENABLE_PEDANTIC is set.
However, Clang's CMakeLists.txt unilaterally adds -pedantic to the run
line, so we need to disable -Wnested-anon-types explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176393 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02 00:49:47 +00:00
Jordan Rose 067e9684ac [analyzer] Update open source checker build to checker-272.
See http://clang-analyzer.llvm.org/release_notes.html for what's new
in this build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176389 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 23:26:05 +00:00
Jordan Rose d764e20189 [analyzer] Special-case bitfields when finding sub-region bindings.
Previously we were assuming that we'd never ask for the sub-region bindings
of a bitfield, since a bitfield cannot have subregions. However,
unification of code paths has made that assumption invalid. While we could
take advantage of this by just checking for the single possible binding,
it's probably better to do the right thing, so that if/when we someday
support unions we'll do the right thing there, too.

This fixes a handful of false positives in analyzing LLVM.

<rdar://problem/13325522>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176388 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 23:03:17 +00:00
Fariborz Jahanian c98e9130bc comment parsing. Keep the original command format
in AST for source fidelity and use it in diagnostics 
to refer to the original format. // rdar://13066276


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176387 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 22:51:30 +00:00
Stefanus Du Toit fc09336a59 Fix typos: [Dd]iagnosic -> [Dd]iagnostic
These all appear in comments or (ironically) diagnostics output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176383 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 21:41:22 +00:00
Jordan Rose 9abf1b4577 [analyzer] Suppress paths involving a reference whose rvalue is null.
Most map types have an operator[] that inserts a new element if the key
isn't found, then returns a reference to the value slot so that you can
assign into it. However, if the value type is a pointer, it will be
initialized to null. This is usually no problem.

However, if the user /knows/ the map contains a value for a particular key,
they may just use it immediately:

   // From ClangSACheckersEmitter.cpp
   recordGroupMap[group]->Checkers

In this case the analyzer reports a null dereference on the path where the
key is not in the map, even though the user knows that path is impossible
here. They could silence the warning by adding an assertion, but that means
splitting up the expression and introducing a local variable. (Note that
the analyzer has no way of knowing that recordGroupMap[group] will return
the same reference if called twice in a row!)

We already have logic that says a null dereference has a high chance of
being a false positive if the null came from an inlined function. This
patch simply extends that to references whose rvalues are null as well,
silencing several false positives in LLVM.

<rdar://problem/13239854>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176371 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 19:45:10 +00:00
Daniel Jasper 516fb31d05 Remove whitespace at end of file.
This fixes the rest of llvm.org/PR15062.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176361 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 18:11:39 +00:00
Daniel Jasper 8a5d7cd100 Correctly format arrays of pointers and function types.
Before:
void f(Type(*parameter)[10]) {}
int(*func)(void *);

After:
void f(Type (*parameter)[10]) {}
int (*func)(void *);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176356 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 17:13:29 +00:00
Argyrios Kyrtzidis 9b5b65957c [PCH] Remove building a SmallPtrSet that is not actually used for anything.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176354 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 17:01:31 +00:00
Daniel Jasper 248497199b Normal indent for last element of builder-type call.
In builder type call, we indent to the laster function calls.
However, for the last element of such a call, we don't need to do
so, as that normally just wastes space and does not increase
readability.

Before:
aaaaaa->aaaaaa->aaaaaa( // break
                  aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa
    ->aaaaaaaaaaaaaaaaaaaaaaaaaa(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaa->aaaaaa->aaaaaa( // break
    aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176352 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 16:48:32 +00:00
Daniel Jasper 812c045e59 Remove trailing whitespace of line comments.
This fixed llvm.org/PR15378.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176351 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 16:45:59 +00:00
Manuel Klimek bc30c71d20 Implements breaking string literals at slashes.
We now break at a slash if we do not find a space to break on.

Also fixes a bug where we would go over the limit when breaking the
second line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 13:29:19 +00:00
Manuel Klimek af31fd7021 Implement fallback split point for string literals.
If we don't find a natural split point (currently space) in a string
literal protruding over the line, we just split at the last possible
point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176349 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 13:14:08 +00:00
John McCall 2fbe92cc24 Perform the receiver-expression transformations regardless of
whether we already have a method.  Fixes a bug where we were
failing to properly contextually convert a message receiver
during template instantiation.

As a side-effect, we now actually perform correct method lookup
after adjusting a message-send to integral or non-ObjC pointer
types (legal outside of ARC).

rdar://13305374

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176339 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 09:20:14 +00:00
John McCall b2381b1c91 Attempt to not place ownership qualifiers on the result type
of block declarators.  Document the rule we use.

Also document the rule that Doug implemented a few weeks ago
which drops ownership qualifiers on function result types.

rdar://10127067

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176336 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 07:58:16 +00:00
Anna Zaks df539194a0 [analyzer] Reword FAQ
Reword the FAQ to stress more that the assert should be used only in case
the developer is sure that the issue is a false positive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176335 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 06:38:16 +00:00
Argyrios Kyrtzidis 838a920fda Add one more sanity check in SourceManager::getFileIDLoaded().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176333 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 03:43:33 +00:00
Argyrios Kyrtzidis 8504b7b810 [PCH] Enhance InputFile to also include whether the file is out-of-date.
Previously we would return null for an out-of-date file. This inhibited ASTReader::ReadSLocEntry
from creating a FileID to recover gracefully in such a case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176332 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 03:26:04 +00:00
Argyrios Kyrtzidis 7db4bb9226 In SourceManager::getFileIDLoaded(), add some sanity checks to make sure we don't enter an infinite loop.
rdar://13120919

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176331 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 03:26:00 +00:00
John McCall 4a68c7bc86 Restore order to placate test. I had no real reason to switch them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176328 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 01:38:54 +00:00
John McCall ed383135bc Re-use bit from superclass and extract stuff into a local
function.  Serves a patch we're kicking around out-of-tree.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176327 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 01:24:35 +00:00
Fariborz Jahanian d1084f6dd1 Fix warning text of my last patch.
// rdar://13158394


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176308 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 23:16:39 +00:00
Bill Wendling be9e8bfef6 Add more of the command line options as attribute flags.
These can be easily queried by the back-end.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176304 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 22:49:57 +00:00
Fariborz Jahanian ced0e6570a objective-C: clang, following gcc, warns on
use of stand-alone protocol as type and uses
id<proto>. Modify warning to say what compiler 
is doing. // rdar//13158394


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176303 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 22:36:31 +00:00
John McCall bd7370a786 Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple.  This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention.  Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect.  However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility.  Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile;  so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176286 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 19:01:20 +00:00
Hans Wennborg 280b956c8e ClangFormat.rst: Fix two small typos
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176276 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 18:16:24 +00:00
Manuel Klimek 8ddfb0b72d Fix a problem where 'clang' is ambiguous in MSVC builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176275 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 18:12:44 +00:00
Fariborz Jahanian 809d1f1f80 Add comment to my last test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176272 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 18:03:28 +00:00
Fariborz Jahanian b98f7af568 objective-C code completion. Property accessors may not
have their own code completion comments. Use those in 
their properties in this case. 
// rdar://12791315


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176271 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 17:47:14 +00:00
Daniel Jasper 25e81b255c Reduce penalty for splitting after "{" in static initializers.
This fixes llvm.org/PR15379.

Before:
const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = { 0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00,                  // comment
                                            0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00,                  // comment
                                            0x00, 0x00, 0x00, 0x00 // comment
};

After:
const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment
  0x00, 0x00, 0x00, 0x00              // comment
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176262 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 15:04:12 +00:00
Daniel Jasper 8ed4100410 Dont break between (( in __attribute__((.
Before:
void aaaaaaaaaaaaaaaaaa() __attribute__(
    (aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
     aaaaaaaaaaaaaaaaaaaaaaaaa));

After:
void aaaaaaaaaaaaaaaaaa()
    __attribute__((aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
                   aaaaaaaaaaaaaaaaaaaaaaaaa));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176260 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 14:44:25 +00:00
David Chisnall de38cb1fc8 Improve property metadata generation with the GNUstep runtime.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 13:59:29 +00:00
Daniel Jasper 9c3c7b3130 No spaces around pointers to members.
Before: (a ->* f)()
After:  (a->*f)()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 13:40:17 +00:00
Manuel Klimek ff9a01000f First step towards adding a parent map to the ASTContext.
This does not yet implement the LimitNode approach discussed.

The impact of this is an O(n) in the number of nodes in the AST
reduction of complexity for certain kinds of matchers (as otherwise the
parent map gets recreated for every new MatchFinder).

See FIXMEs in the comments for the direction of future work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176251 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 13:21:39 +00:00
Daniel Jasper a4d4621b20 Improve formatting of #defines.
Two improvements:
1) Always leave at least one space before "\". Otherwise is can look bad
   and there is a risk of unwillingly joining to characters to a different
   token.
2) Use the full column limit for single-line #defines.
   Fixes llvm.org/PR15148

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176245 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 11:05:57 +00:00
Daniel Jasper b6f02f3bcb Fix bug when formatting "A<A<A>>".
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                     int aaaaaaaaaaaaaaaaaaaaaaa);
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                   int aaaaaaaaaaaaaaaaaaaaaaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176244 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 10:06:05 +00:00
Daniel Jasper 3a39ac7cee Fix incorrect recognition of bin-packing.
Before (in Google style):
Constructor()
    : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(
          aaaaaa) {}

After:
Constructor()
    : aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176242 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 09:39:12 +00:00
Daniel Jasper 807809c421 Fix spacing after binary operator as macro parameter.
Before: COMPARE(a, == , b);
After:  COMPARE(a, ==, b);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176241 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 09:21:10 +00:00
Evgeniy Stepanov 16cda861c5 Fix global overflow in types::lookupTypeForTypeSpecifier.
memcpy() is allowed to read entire contents of both memory areas.

Found with AddressSanitizer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176237 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 07:53:32 +00:00
Jordan Rose e33d852452 [analyzer] RegionStore: collectSubRegionKeys -> collectSubRegionBindings
By returning the (key, value) binding pairs, we save lookups afterwards.
This also enables further work later on.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176230 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 01:53:08 +00:00
Jordan Rose a19dc41bd4 [analyzer] Mark the root SVal class as isPodLike.
Pure optimization, no functionality change. Probably does not make much
of a difference, but it's free.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176229 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 01:53:03 +00:00