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

43275 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith d92277928e PR15290: 'this' is not permitted in the declaration of a friend function,
therefore references to members should not be transformed into implicit uses of
'this'. Patch by Ismail Pazarbasi!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177134 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15 00:41:52 +00:00
Eric Christopher e462c60ac3 Silence anonymous type in anonymous union warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177133 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15 00:32:52 +00:00
Fariborz Jahanian 96db329b3a Diagnose about extern "C" functions returning c++ objects
on first declaration only. // rdar://13364028


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 23:09:00 +00:00
Argyrios Kyrtzidis 57f8da506a Don't try to typo-correct 'super' in an objc method.
This created 2 issues:

1) Performance issue, since typo-correction with PCH/modules is rather expensive.
2) Correctness issue, since if it managed to "correct" 'super' then bogus compiler errors would
be emitted, like this:

3.m:8:3: error: unknown type name 'super'; did you mean 'super1'?
  super.x = 0;
  ^~~~~
  super1
t3.m:5:13: note: 'super1' declared here
typedef int super1;
            ^
t3.m:8:8: error: expected identifier or '('
  super.x = 0;
       ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177126 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 22:56:43 +00:00
Adrian Prantl 503836ae83 Add a testcase for r177118.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177124 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 22:49:05 +00:00
Anna Zaks a4bb4f6ca8 [analyzer] Change the way in which IDC Visitor decides to kick in and make sure it attaches in the given edge case
In the test case below, the value V is not constrained to 0 in ErrorNode but it is in node N.
So we used to fail to register the Suppression visitor.

We also need to change the way we determine that the Visitor should kick in because the node N belongs to
the ExplodedGraph and might not be on the BugReporter path that the visitor sees. Instead of trying to match the node,
turn on the visitor when we see the last node in which the symbol is ‘0’.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177121 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 22:31:56 +00:00
Adrian Prantl bea407c927 Always declare the .block_descriptor parameter, not just the local copy.
Un-breaks gdb's invoke-block behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177118 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 21:52:59 +00:00
Douglas Gregor 7f99d5c541 [PR15513/<rdar://problem/13409707>] Template arguments in diagnostics aren't always known at compile time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177110 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 20:44:43 +00:00
Adrian Prantl 836e7c9357 Allocate stack storage for .block_descriptor and captured self at -O0.
This way the register allocator will not optimize away the debug info
for captured variables.

Fixes rdar://problem/12767564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177086 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 17:53:33 +00:00
Jordan Rose 4a374f9a58 [analyzer] Fix scan-build's -stats mode.
We were failing to match the output line, which led to us collecting no
stats at all, which led to a divide-by-zero error.

Fixes PR15510.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177084 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 17:18:30 +00:00
Manuel Klimek 374516c8ec Implements memoization for ancestor matching.
This yields a log(#ast_nodes) worst-case improvement with matchers like
stmt(unless(hasAncestor(...))).

Also made the order of visitation for ancestor matches BFS, as the most
common use cases (for example finding the closest enclosing function
definition) rely on that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 16:33:21 +00:00
Alexander Kornienko f753615897 Multi-line comment alignment
Summary:
Aligns continuation lines of multi-line comments to the base
indentation level +1:
class A {
  /*
   * test
   */
  void f() {}
};

The first revision is work in progress. The implementation is not yet complete.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D541

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177080 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 16:10:54 +00:00
Daniel Jasper bfa1edd824 Slightly improve formatting of longer pipe statements.
The stronger binding of a string ending in :/= does not really make
sense if it is the only character.

Before:
llvm::outs() << aaaaaaaaaaaaaaaaaaaaaaaa
             << "=" << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

After:
llvm::outs() << aaaaaaaaaaaaaaaaaaaaaaaa << "="
             << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177075 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 14:00:17 +00:00
Daniel Jasper 923ebef120 Basic support for formatting asm() statments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177073 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 13:45:21 +00:00
Dmitri Gribenko 23219daa70 Documentation: improve formatting
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177066 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 12:53:46 +00:00
Alexey Samsonov f37b1e2415 [ASan] Update docs for -fsanitize=init-order option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177062 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 12:26:21 +00:00
Alexey Samsonov 7ac415b489 [ASan] Make -fsanitize=address imply -fsanitize=init-order (if the latter is not explicitly disabled).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177061 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 12:13:27 +00:00
Chandler Carruth 8f0d1f053f Fix an unused variable warning from Clang by sinking a dyn_cast into an
isa and a cast inside the assert. The efficiency concern isn't really
important here. The code should likely be cleaned up a bit more,
especially getting a message into the assert.

Please review Rafael.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177053 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 11:17:20 +00:00
Daniel Jasper d3cf17b5f1 Fix dereference formatting in for-loops.
Before: for (char **a = b; * a; ++a) {}
After:  for (char **a = b; *a; ++a) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177037 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 10:50:25 +00:00
Joey Gouly 96cead5137 Add support for the 'endian' attribute for OpenCL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177035 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 09:54:43 +00:00
Daniel Jasper 8ef19a2295 Improve formatting of trailing annotations.
Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa __attribute__((
    unused));

After:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    __attribute__((unused));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177034 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 09:50:46 +00:00
Nick Lewycky c3ae583a9a Update GCOVProfiling pass creation for API change in r177002. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 05:14:01 +00:00
John McCall e34db6b3e7 Flag that friend function definitions are "late parsed" so that
template instantiation will still consider them to be definitions
if we instantiate the containing class before we get around
to parsing the friend.

This seems like a legitimate use of "late template parsed" to me,
but I'd appreciate it if someone responsible for the MS feature
would look over this.

This file already appears to access AST nodes directly, which
is arguably not kosher in the parser, but the performance of this
path matters enough that perpetuating the sin is justifiable.
Probably we ought to reconsider this policy for very simple
manipulations like this.

The reason this entire thing is necessary is that
function template instantiation plays some very gross games
in order to not associate an instantiated function template
with the class it came from unless it's a definition, and
the reason *that's* necessary is that the AST currently
cannot represent the instantiation history of individual
function template declarations, but instead tracks it in
common for the entire function template.  That probably
prevents us from correctly reporting ill-formed calls to
ambiguously instantiated friend function templates.

rdar://12350696

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177003 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 05:13:41 +00:00
Argyrios Kyrtzidis faf01f02f6 [modules] Don't write the UnusedFileScopedDecls vector to the module file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177001 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 04:45:00 +00:00
Argyrios Kyrtzidis 975d353997 [modules] Check for delegating constructor cycles when building a module and don't write them out to the module file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177000 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 04:44:56 +00:00
Rafael Espindola 2d1b09641e Avoid computing the linkage too early. Don't invalidate it.
Before this patch we would compute the linkage lazily and cache it. When the
AST was modified in ways that could change the value, we would invalidate the
cache.

That was fairly brittle, since any code could ask for the a linkage before
the correct value was available.

We should change the API to one where the linkage is computed explicitly and
trying to get it when it is not available asserts.

This patch is a first step in that direction. We still compute the linkage
lazily, but instead of invalidating a cache, we assert that the AST
modifications didn't change the result.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176999 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 03:07:35 +00:00
Bill Wendling aa778f1e4f Really fix the MIPS test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176991 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 22:44:19 +00:00
Bill Wendling 7c527e4f53 Attempt to fix test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176987 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 22:29:26 +00:00
Bill Wendling 4159f05999 Have these attriubtes set to 'true' or 'false'.
The back-end cannot differentiate between functions that are from a .ll file and
those generated from the front-end. We cannot then take the non-precense of
these attributes as a "false" value. Have the front-end explicitly set the value
to 'true' or 'false' depending upon what is actually set.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176985 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 22:24:33 +00:00
Argyrios Kyrtzidis 55ea75bf61 [Modules] Don't eagerly load and associate all the module header files.
In a module-enabled Cocoa PCH file, we spend a lot of time stat'ing the headers
in order to associate the FileEntries with their modules and support implicit
module import.

Use a more lazy scheme by enhancing HeaderInfoTable to store extra info about
the module that a header belongs to, and associate it with its module only when
there is a request for loading the header info for a particular file.

Part of rdar://13391765

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176976 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 21:13:51 +00:00
Argyrios Kyrtzidis c1d2239362 [Modules] Resolve top-headers of modules lazily.
This allows resolving top-header filenames of modules to FileEntries when
we need them, not eagerly.

Note that that this breaks ABI for libclang functions
clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders
but this is fine because they are experimental and not widely used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176975 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 21:13:43 +00:00
Reed Kotler ad4b8b43e6 Cause the mips16/nomips16 attribute to be passed to LLVM from Clang
in the LLVM assembly language output.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176971 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 20:40:30 +00:00
Anna Zaks 6022c4e17c [analyzer] BugReporter - more precise tracking of C++ references
When BugReporter tracks C++ references involved in a null pointer violation, we
want to differentiate between a null reference and a reference to a null pointer. In the
first case, we want to track the region for the reference location; in the second, we want
to track the null pointer.

In addition, the core creates CXXTempObjectRegion to represent the location of the
C++ reference, so teach FindLastStoreBRVisitor about it.

This helps null pointer suppression to kick in.

(Patch by Anna and Jordan.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176969 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 20:20:14 +00:00
Ted Kremenek 1b125665be Remove stray space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176966 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 20:05:52 +00:00
Ted Kremenek c5b9c8bc6d [analyzer] Handle Objc Fast enumeration for "loop is executed 0 times".
Fixes <rdar://problem/12322528>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176965 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 20:03:31 +00:00
Daniel Jasper 6a365aaa05 Fix incorrect cast identification.
Before: int a = sizeof(int *)+ b;"
After:  int a = sizeof(int *) + b;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176957 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 17:13:53 +00:00
Anton Yartsev 3258d4b3fb [analyzer] fixed the logic changed by r176949
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176956 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 17:07:32 +00:00
Adrian Prantl b38b3cd64c relax check to allow for attributes (fix buildbot for elf-ppc64)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176954 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 16:14:44 +00:00
Daniel Jasper 6050a1e53a Fix comment indentation before labels.
Before:
switch (x) {
  // if 1, do f()
case 1:
  f();
}

After:
switch (x) {
// if 1, do f()
case 1:
  f();
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176953 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 15:53:12 +00:00
Daniel Jasper 8d0d19aa33 Fix formatting issue with builder-type calls.
Before:
->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() - aaaaaaaaa()->aaaaaa()
                                                             ->aaaaa());

After:
a->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() -
                         aaaaaaaaa()->aaaaaa()->aaaaa());

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176952 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 15:37:48 +00:00
Alexander Kornienko e74de28ec3 Added AnnotatedToken::isOneOf + a few other refactorings
Summary: <subj>

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D536

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176951 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 14:41:29 +00:00
Anton Yartsev bb3699543e Refactoring:
+ Individual Report* method for each bug type
+ Comment improved: missing non-trivial alloca() case annotated
+ 'range' parameter of ReportBadFree() capitalized
+ 'SymbolRef Sym = State->getSVal(A, C.getLocationContext()).getAsSymbol();' shorten to 'SymbolRef Sym = C.getSVal(A).getAsSymbol();'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176949 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 14:39:10 +00:00
Dmitri Gribenko 8eb3022fa8 Documentation: formatting fixes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176948 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 14:26:35 +00:00
Edwin Vane c45df068ee Reverting r176944 until Author fixes test failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 13:48:47 +00:00
Edwin Vane eea6a13b8e ClangTool output cleanup
Information messages sent to stdout by ClangTool now only happen when the -debug
flag is set.

Error messages that used to go to stdout now go to stderr.

Author: Ariel J Bernal <ariel.j.bernal@intel.com>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176944 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 13:36:56 +00:00
Evgeniy Stepanov 1d5b1b37e0 Add llvm-symbolizer as test dependency.
It is required when building tests with ASan or MSan.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176942 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 09:36:02 +00:00
Daniel Jasper 6f21a98899 Fix formatting of new arrays of pointers.
Before:
A = new SomeType * [Length];
A = new SomeType *[Length]();

After:
A = new SomeType *[Length];
A = new SomeType *[Length]();

Small formatting cleanups with clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176936 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 07:49:51 +00:00
Evgeniy Stepanov e0d5c86687 Set symbolizer path in the test environment.
This is needed to get symbolized stack traces when running Clang tests under (A|M)San.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176934 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 07:10:36 +00:00
John McCall 99c6418e37 Remove trailing comma in enum list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176926 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 05:02:21 +00:00
John McCall 5b07e8077a Tighten up the rules for precise lifetime and document
the requirements on the ARC optimizer.

rdar://13407451

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176924 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 03:10:54 +00:00