]> granicus.if.org Git - clang/log
clang
13 years agoRevert x86_64 ABI changes until I have time to check the items raised by Eli.
Bruno Cardoso Lopes [Fri, 8 Jul 2011 22:57:35 +0000 (22:57 +0000)]
Revert x86_64 ABI changes until I have time to check the items raised by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134765 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntroduce __builtin_expect() intrinsic support.
Jakub Staszak [Fri, 8 Jul 2011 22:45:14 +0000 (22:45 +0000)]
Introduce __builtin_expect() intrinsic support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134761 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)
Bruno Cardoso Lopes [Fri, 8 Jul 2011 22:18:40 +0000 (22:18 +0000)]
Add support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134754 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd codegen support for the fma/fmal/fmaf builtins.
Cameron Zwarich [Fri, 8 Jul 2011 21:39:34 +0000 (21:39 +0000)]
Add codegen support for the fma/fmal/fmaf builtins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134743 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitialize all the AnalysisBasedWarnings statistics to zero.
Benjamin Kramer [Fri, 8 Jul 2011 20:38:53 +0000 (20:38 +0000)]
Initialize all the AnalysisBasedWarnings statistics to zero.

Found by valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134733 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove unused variable.
Benjamin Kramer [Fri, 8 Jul 2011 20:20:17 +0000 (20:20 +0000)]
Remove unused variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134731 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix up dependency file name printing to more closely match that of gcc, including...
Eli Friedman [Fri, 8 Jul 2011 20:17:28 +0000 (20:17 +0000)]
Fix up dependency file name printing to more closely match that of gcc, including fixing a nasty recent regression that could make us print "/foo.h" with a command-line including "-I ./".

rdar://problem/9734352

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134728 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc++-arc: more diagnosis of converting a weak-unavailable
Fariborz Jahanian [Fri, 8 Jul 2011 17:41:42 +0000 (17:41 +0000)]
objc++-arc: more diagnosis of converting a weak-unavailable
object to a __weak object type. // rdar://9732636

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134706 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach CXXUnresolvedConstructExpr when it should be an
Douglas Gregor [Fri, 8 Jul 2011 15:50:43 +0000 (15:50 +0000)]
Teach CXXUnresolvedConstructExpr when it should be an
lvalue/xvalue/rvalue, rather than just (incorrectly) assuming it's an
lvalue. Fixes PR10285 / <rdar://problem/9743926>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134700 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd several CFG-stress-testing input source files. These use the
Chandler Carruth [Fri, 8 Jul 2011 11:20:51 +0000 (11:20 +0000)]
Add several CFG-stress-testing input source files. These use the
preprocessor to build up very large CFGs in various shapes that can
produce different algorithmic behavior in CFG-walking code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134698 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the worklist in the uninitialized values checker actually a queue.
Chandler Carruth [Fri, 8 Jul 2011 11:19:06 +0000 (11:19 +0000)]
Make the worklist in the uninitialized values checker actually a queue.
Previously, despite the names 'enqueue' and 'dequeue', it behaved as
a stack and visited blocks in a LIFO fashion. This interacts badly with
extremely broad CFGs *inside* of a loop (such as a large switch inside
a state machine) where every block updates a different variable.

When encountering such a CFG, the checker visited blocks in essentially
a "depth first" order due to the stack-like behavior of the work list.
Combined with each block updating a different variable, the saturation
logic of the checker caused it to re-traverse blocks [1,N-1] of the
broad CFG inside the loop after traversing block N. These re-traversals
were to propagate the variable values derived from block N. Assuming
approximately the same number of variables as inner blocks exist, the
end result is O(N^2) updates. By making this a queue, we also make the
traversal essentially "breadth-first" across each of the N inner blocks
of the loop. Then all of this state is propagated around to all N inner
blocks of the loop. The result is O(N) updates.

The truth is in the numbers:
Before, gcc.c:   96409 block visits  (max: 61546,   avg: 591)
After,  gcc.c:   69958 block visits  (max: 33090,   avg: 429)
Before, PR10183: 2540494 block vists (max: 2536495, avg: 37360)
After,  PR10183: 137803 block visits (max: 134406,  avg: 2026)

The nearly 20x reduction in work for PR10183 corresponds to a roughly
100x speedup in compile time.

I've tested it on all the code I can get my hands on, and I've seen no
slowdowns due to this change. Where I've collected stats, the ammount of
work done is on average less. I'll also commit shortly some synthetic
test cases useful in analyzing the performance of CFG-based warnings.

Submitting this based on Doug's feedback that post-commit review should
be good. Ted, please review! Hopefully this helps compile times until
then.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134697 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a FIXME in clang ARM driver that was exposed as a bug with ARM backend
Evan Cheng [Fri, 8 Jul 2011 06:40:11 +0000 (06:40 +0000)]
Fix a FIXME in clang ARM driver that was exposed as a bug with ARM backend
change.

Previously clang was passing the following feature strings to the ARM backend
when CPU is cortex-a8: +neon,-vfp2,-vfp3

This used to work because -vfp2,-vfp3 had no effect after +neon. Now that the
features are controlled by individual bits (with implied hierarchy), the net
effect is all three features will be turned off.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134691 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRandom cleanup:
Francois Pichet [Fri, 8 Jul 2011 06:21:47 +0000 (06:21 +0000)]
Random cleanup:
- fix a comment.
- Remove an unnecessary { } block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134690 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove a no-op break after a return, and correct one of the most
Chandler Carruth [Fri, 8 Jul 2011 04:59:44 +0000 (04:59 +0000)]
Remove a no-op break after a return, and correct one of the most
confusing indentations I've seen recently... Just noticed these while
making a change elsewhere.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134685 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMinor style cleanup.
Chandler Carruth [Fri, 8 Jul 2011 04:28:55 +0000 (04:28 +0000)]
Minor style cleanup.

Original patch by John Freeman, some style tweaks by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134683 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate the creation of the TargetAsmParser based on API change in r134678.
Chandler Carruth [Fri, 8 Jul 2011 03:15:48 +0000 (03:15 +0000)]
Update the creation of the TargetAsmParser based on API change in r134678.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134680 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTweak formatting.
Chandler Carruth [Fri, 8 Jul 2011 01:04:24 +0000 (01:04 +0000)]
Tweak formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134675 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the token-paste source locations inside of function style macro
Chandler Carruth [Fri, 8 Jul 2011 01:04:21 +0000 (01:04 +0000)]
Switch the token-paste source locations inside of function style macro
argument expansion to use the macro argument source locations as well.
Add a few tests to exercise this. There is still a bit more work needed
here though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134674 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoKeep track of which source locations are part of a macro argument
Chandler Carruth [Thu, 7 Jul 2011 23:56:36 +0000 (23:56 +0000)]
Keep track of which source locations are part of a macro argument
instantiation and improve diagnostics which are stem from macro
arguments to trace the argument itself back through the layers of macro
expansion.

This requires some tricky handling of the source locations, as the
argument appears to be expanded in the opposite direction from the
surrounding macro. This patch provides helper routines that encapsulate
the logic and explain the reasoning behind how we step through macros
during diagnostic printing.

This fixes the rest of the test cases originially in PR9279, and later
split out into PR10214 and PR10215.

There is still some more work we can do here to improve the macro
backtrace, but those will follow as separate patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134660 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a testcase for the previous commit and update an existing test for an
Eric Christopher [Thu, 7 Jul 2011 23:11:01 +0000 (23:11 +0000)]
Add a testcase for the previous commit and update an existing test for an
extra register.

Part of PR10299 and rdar://9740322

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134657 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc++-arc: diagnose assignment/cast of a weak-unavailable
Fariborz Jahanian [Thu, 7 Jul 2011 23:04:17 +0000 (23:04 +0000)]
objc++-arc: diagnose assignment/cast of a weak-unavailable
object to a __weak object/type. // rdar://9732636.
One item is yet todo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134655 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a typo in the fpsr register and add the fpcr register.
Eric Christopher [Thu, 7 Jul 2011 22:55:26 +0000 (22:55 +0000)]
Fix a typo in the fpsr register and add the fpcr register.

Fixes PR10299 and rdar://9740322

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134654 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove BoostCon-specific code from Clang. FWIW, I'm a fan of things like this living...
Jonathan D. Turner [Thu, 7 Jul 2011 22:40:15 +0000 (22:40 +0000)]
Remove BoostCon-specific code from Clang.  FWIW, I'm a fan of things like this living in a separate branch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134649 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since...
Argyrios Kyrtzidis [Thu, 7 Jul 2011 21:54:45 +0000 (21:54 +0000)]
Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since they depend on it now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134644 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoLayout the code for trapping arithmetic so that the overflow case comes after
Bill Wendling [Thu, 7 Jul 2011 21:13:10 +0000 (21:13 +0000)]
Layout the code for trapping arithmetic so that the overflow case comes after
the normal case.

Before, for this:

$ cat t.c
int test(int x) { return x * 2; }

We would get this:

   addl  %edi, %edi
   jno   LBB0_2
## BB#1:                                ## %overflow
   ud2
LBB0_2:                                 ## %nooverflow
   movl    %edi, %eax
   popq    %rbp
   ret

Now we get this:

   addl   %edi, %edi
   jo     LBB0_2
## BB#1:                                ## %nooverflow
   movl                                 %edi, %eax
   popq                                 %rbp
   ret
LBB0_2:                                 ## %overflow
   ud2

<rdar://problem/8283919>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134642 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agor134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,
Cameron Zwarich [Thu, 7 Jul 2011 21:03:28 +0000 (21:03 +0000)]
r134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,
so roll it out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134638 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoA redeclaration of an inline method in C99 mode should trigger emission of that
Nick Lewycky [Thu, 7 Jul 2011 20:25:10 +0000 (20:25 +0000)]
A redeclaration of an inline method in C99 mode should trigger emission of that
function. Fixes PR10233!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134634 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUndo r134587 as the bug was actually a deep and hideous one in the
Sean Hunt [Thu, 7 Jul 2011 20:14:21 +0000 (20:14 +0000)]
Undo r134587 as the bug was actually a deep and hideous one in the
client code.

My bad.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134631 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: diagnose assignment/cast of a weak-unavailable
Fariborz Jahanian [Thu, 7 Jul 2011 18:55:47 +0000 (18:55 +0000)]
objc-arc: diagnose assignment/cast of a weak-unavailable
object to a __weak object/type. // rdar://9732636.
This is objc side of things. objc++ side tbd.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134624 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTurn hashhash into tok::unkwown when it comes from expanding an argument, per Chris...
Argyrios Kyrtzidis [Thu, 7 Jul 2011 18:04:47 +0000 (18:04 +0000)]
Turn hashhash into tok::unkwown when it comes from expanding an argument, per Chris' suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134621 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFreeBSD gets FreeBSD target, just mipsel.
Joerg Sonnenberger [Thu, 7 Jul 2011 17:01:45 +0000 (17:01 +0000)]
FreeBSD gets FreeBSD target, just mipsel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134619 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSlightly improve the code to derive target from program name to not
Joerg Sonnenberger [Thu, 7 Jul 2011 16:57:26 +0000 (16:57 +0000)]
Slightly improve the code to derive target from program name to not
fault if no arguments are given.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134618 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntroduce a new libclang aPI function,
Douglas Gregor [Thu, 7 Jul 2011 16:03:39 +0000 (16:03 +0000)]
Introduce a new libclang aPI function,
clang_codeCompleteGetContexts(), that provides the client with
information about the context in which code completion has occurred
and what kinds of entities make sense as completions at that
point. Patch by Connor Wakamo!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134615 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIf we're using the pure non-fragile ABI, then skip some of the contortions required...
David Chisnall [Thu, 7 Jul 2011 12:34:51 +0000 (12:34 +0000)]
If we're using the pure non-fragile ABI, then skip some of the contortions required to support the transitional ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134612 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSet a flag to tell the runtime when we're compiling in ARC mode and use the pure...
David Chisnall [Thu, 7 Jul 2011 11:22:31 +0000 (11:22 +0000)]
Set a flag to tell the runtime when we're compiling in ARC mode and use the pure-nonfragile ABI for both ARC and GC mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134611 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix example: variable is initialized to 10 and then has 11 stored in it, but in the...
David Chisnall [Thu, 7 Jul 2011 09:49:59 +0000 (09:49 +0000)]
Fix example: variable is initialized to 10 and then has 11 stored in it, but in the expanded version is initialized to 11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134610 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn ARC, reclaim all return values of retainable type, not just those
John McCall [Thu, 7 Jul 2011 06:58:02 +0000 (06:58 +0000)]
In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value.

As an exception, don't do this when the call is made as the immediate
operand of a __bridge retain.  This is more in the way of a workaround
than an actual guarantee, so it's acceptable to be brittle here.

rdar://problem/9504800

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134605 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Add -ccc-arcmt-check/-ccc-arcmt-modify driver option aliases.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 04:00:39 +0000 (04:00 +0000)]
[arcmt] Add -ccc-arcmt-check/-ccc-arcmt-modify driver option aliases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134591 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSort #includes.
Nick Lewycky [Thu, 7 Jul 2011 03:54:51 +0000 (03:54 +0000)]
Sort #includes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134589 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen expanding macro arguments, treat '##' coming from an argument as a normal token.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:37 +0000 (03:40 +0000)]
When expanding macro arguments, treat '##' coming from an argument as a normal token.

e.g.

#define M(x) A x B
M(##) // should expand to 'A ## B', not 'AB'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134588 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the Preprocessor more memory efficient and improve macro instantiation diagnostics.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:34 +0000 (03:40 +0000)]
Make the Preprocessor more memory efficient and improve macro instantiation diagnostics.

When a macro instantiation occurs, reserve a SLocEntry chunk with length the
full length of the macro definition source. Set the spelling location of this chunk
to point to the start of the macro definition and any tokens that are lexed directly
from the macro definition will get a location from this chunk with the appropriate offset.

For any tokens that come from argument expansion, '##' paste operator, etc. have their
instantiation location point at the appropriate place in the instantiated macro definition
(the argument identifier and the '##' token respectively).
This improves macro instantiation diagnostics:

Before:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
        ^~~~
t.c:5:11: note: instantiated from:
int y = M(/);
          ^

After:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
        ^~~~
t.c:3:20: note: instantiated from:
\#define M(op) (foo op 3);
                ~~~ ^  ~
t.c:5:11: note: instantiated from:
int y = M(/);
          ^

The memory savings for a candidate boost library that abuses the preprocessor are:

- 32% less SLocEntries (37M -> 25M)
- 30% reduction in PCH file size (900M -> 635M)
- 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134587 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix bug in SourceManager::getDecomposedInstantiationLocSlowCase.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:27 +0000 (03:40 +0000)]
Fix bug in SourceManager::getDecomposedInstantiationLocSlowCase.

It would add up relative (decomposed) offsets like in getDecomposedSpellingLocSlowCase, but while
it makes sense to preserve the offset among lexed spelling locations, it doesn't make
sense to add anything to the offset of the instantiation location. The instantiation
location will be the same regardless of the relative offset in the tokens that were
instantiated.

This bug didn't actually affect anything because, currently, in practice we never create macro
locations with relative offset greater than 0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134586 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFor -print-stats, add the number of bytes that SLocEntryTable consumes.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:24 +0000 (03:40 +0000)]
For -print-stats, add the number of bytes that SLocEntryTable consumes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134585 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn an in-class initialization, defer checks for value-dependent initialization
Nick Lewycky [Thu, 7 Jul 2011 02:20:13 +0000 (02:20 +0000)]
In an in-class initialization, defer checks for value-dependent initialization
expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134583 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoZap a couple unnecessary loops.
Eli Friedman [Thu, 7 Jul 2011 01:54:01 +0000 (01:54 +0000)]
Zap a couple unnecessary loops.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134578 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDo not violate the opencl casting rules. This test case still illustrates the problem...
Tanya Lattner [Thu, 7 Jul 2011 00:12:54 +0000 (00:12 +0000)]
Do not violate the opencl casting rules. This test case still illustrates the problem. In the future, we should throw an error when doing invalid casting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134570 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove and elaborate the section on objc_arc_weak_unavailable.
John McCall [Thu, 7 Jul 2011 00:03:42 +0000 (00:03 +0000)]
Move and elaborate the section on objc_arc_weak_unavailable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134567 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnsure that we actually visit function parameter declarations with
Sean Hunt [Wed, 6 Jul 2011 23:35:33 +0000 (23:35 +0000)]
Ensure that we actually visit function parameter declarations with
RecursiveASTVisitor.

This deficiency was discovered while working with the AST matcher
framework and likely impacts other users of RecursiveASTMatcher who
previously weren't seeing these Decls in their visitation.

Patch reviewed by Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134562 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate document for objc_arc_weak_unavailable attribute
Fariborz Jahanian [Wed, 6 Jul 2011 22:56:44 +0000 (22:56 +0000)]
Update document for objc_arc_weak_unavailable attribute
on class declarations. Documentation for // rdar://9693477

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134558 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate document on use of ns_returns_not_retained
Fariborz Jahanian [Wed, 6 Jul 2011 22:47:46 +0000 (22:47 +0000)]
Update document on use of ns_returns_not_retained
attribute on property. Document for // rdar://9636091.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134556 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBased on comments from Chris, switch to using CFG::getNumBlockIDs()
Chandler Carruth [Wed, 6 Jul 2011 22:21:45 +0000 (22:21 +0000)]
Based on comments from Chris, switch to using CFG::getNumBlockIDs()
rather than a computed std::distance(). At some point I had convinced
myself that these two were different; but as far as I can tell on
re-exampination they aren't, and the number of block IDs is actually
just a count of the blocks in the CFG.

While this removes the primary motivation for guarding all of this with
CollectStats, I have a patch coming up that will almost certainly make
it important again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134552 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMSVC doesn't like mixing declarations and statements in a C file.
Francois Pichet [Wed, 6 Jul 2011 22:09:44 +0000 (22:09 +0000)]
MSVC doesn't like mixing declarations and statements in a C file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134550 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProperly implement the scope restriction on the NRVO for
Douglas Gregor [Wed, 6 Jul 2011 22:04:06 +0000 (22:04 +0000)]
Properly implement the scope restriction on the NRVO for
throw-expressions, such that we don't consider the NRVO when the
non-volatile automatic object comes from outside the innermost try
scope (C++0x [class.copymove]p13). In C++98/03, our ASTs were
incorrect but it didn't matter because IR generation doesn't actually
apply the NRVO here. In C++0x, however, we were moving from an object
when in fact we should have copied from it. Fixes PR10142 /
<rdar://problem/9714312>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134548 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate documentation for // rdar://9619861
Fariborz Jahanian [Wed, 6 Jul 2011 21:58:44 +0000 (21:58 +0000)]
Update documentation for // rdar://9619861

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134544 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agorevert patch for // rdar://9227352
Fariborz Jahanian [Wed, 6 Jul 2011 21:05:11 +0000 (21:05 +0000)]
revert patch for // rdar://9227352

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134536 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSome code cleanup of r134522
Fariborz Jahanian [Wed, 6 Jul 2011 20:48:48 +0000 (20:48 +0000)]
Some code cleanup of r134522

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134529 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agocreateMCInstPrinter doesn't need TargetMachine anymore.
Evan Cheng [Wed, 6 Jul 2011 19:45:57 +0000 (19:45 +0000)]
createMCInstPrinter doesn't need TargetMachine anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134526 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: Support objc_arc_weak_unavailable on those
Fariborz Jahanian [Wed, 6 Jul 2011 19:24:05 +0000 (19:24 +0000)]
objc-arc: Support objc_arc_weak_unavailable on those
classes which are incompatible with weak references.
// rdar://9693477

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134522 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't try to type-check a copy construction of an exception
Douglas Gregor [Wed, 6 Jul 2011 18:14:43 +0000 (18:14 +0000)]
Don't try to type-check a copy construction of an exception
declaration with dependent type. Fixes PR10232 /
<rdar://problem/9700653>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134515 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate docs to remove reference to OverloadedFunctionDecl and replace it with DeclCon...
Jonathan D. Turner [Wed, 6 Jul 2011 18:12:36 +0000 (18:12 +0000)]
Update docs to remove reference to OverloadedFunctionDecl and replace it with DeclContext::lookup_result.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134514 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoKeep track of when "unrecoverable" errors occur, then allow
Douglas Gregor [Wed, 6 Jul 2011 17:40:26 +0000 (17:40 +0000)]
Keep track of when "unrecoverable" errors occur, then allow
clang_saveTranslationUnit() to save a PCH file if the only errors it
contains are recoverable errors. Fixes <rdar://problem/9727804>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134503 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSmallVectorize a critical vector.
Benjamin Kramer [Wed, 6 Jul 2011 16:43:46 +0000 (16:43 +0000)]
SmallVectorize a critical vector.

The small number of elements was determined by taking the median
file length in clang+llvm and /usr/include on OS X with xcode installed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134496 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agolibclang: Allow callers of clang_saveTranslationUnit() to distinguish
Douglas Gregor [Wed, 6 Jul 2011 16:43:36 +0000 (16:43 +0000)]
libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134495 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBuild up statistics about the work done for analysis based warnings.
Chandler Carruth [Wed, 6 Jul 2011 16:21:37 +0000 (16:21 +0000)]
Build up statistics about the work done for analysis based warnings.
Special detail is added for uninitialized variable analysis as this has
serious performance problems than need to be tracked.

Computing some of this data is expensive, for example walking the CFG to
determine its size. To avoid doing that unless the stats data is going
to be used, we thread a bit into the Sema object to track whether
detailed stats should be collected or not. This bit is used to avoid
computations whereever the computations are likely to be more expensive
than checking the state of the flag. Thus, counters are in some cases
unconditionally updated, but the more expensive (and less frequent)
aggregation steps are skipped.

With this patch, we're able to see that for 'gcc.c':
*** Analysis Based Warnings Stats:
232 functions analyzed (0 w/o CFGs).
  7151 CFG blocks built.
  30 average CFG blocks per function.
  1167 max CFG blocks per function.
163 functions analyzed for uninitialiazed variables
  640 variables analyzed.
  3 average variables per function.
  94 max variables per function.
  96409 block visits.
  591 average block visits per function.
  61546 max block visits per function.

And for the reduced testcase in PR10183:
*** Analysis Based Warnings Stats:
98 functions analyzed (0 w/o CFGs).
  8526 CFG blocks built.
  87 average CFG blocks per function.
  7277 max CFG blocks per function.
68 functions analyzed for uninitialiazed variables
  1359 variables analyzed.
  19 average variables per function.
  1196 max variables per function.
  2540494 block visits.
  37360 average block visits per function.
  2536495 max block visits per function.

That last number is the somewhat scary one that indicates the problem in
PR10183.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134494 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach the static analyzer's interpretation of Cocoa conventions to
Douglas Gregor [Wed, 6 Jul 2011 16:00:34 +0000 (16:00 +0000)]
Teach the static analyzer's interpretation of Cocoa conventions to
obey the objc_method_family attribute when provided. Fixes
<rdar://problem/9726279>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134493 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse attributes from the definition (if available) when
Rafael Espindola [Wed, 6 Jul 2011 15:46:09 +0000 (15:46 +0000)]
Use attributes from the definition (if available) when
instantiating functions.

Fixes PR10272.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134491 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix C&P error
Joerg Sonnenberger [Wed, 6 Jul 2011 11:00:56 +0000 (11:00 +0000)]
Fix C&P error

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134490 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen tree-transforming an expression sequence, always flag expanded
John McCall [Wed, 6 Jul 2011 07:30:07 +0000 (07:30 +0000)]
When tree-transforming an expression sequence, always flag expanded
variadic argument pack expansions as having changed, rather than doing
it for each changed expansion, which leaves out zero-argument packs
with catastrophic consequences.

Fixes PR10260.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134483 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFixed enum types can be complete without actually being valid to use
John McCall [Wed, 6 Jul 2011 06:57:57 +0000 (06:57 +0000)]
Fixed enum types can be complete without actually being valid to use
as scope specifiers;  diagnose the attempt, rather than letting it go
to an assert.  The rest of PR10264.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134479 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProperly protect colons when parsing a nested-name-specifier as part
John McCall [Wed, 6 Jul 2011 05:58:41 +0000 (05:58 +0000)]
Properly protect colons when parsing a nested-name-specifier as part
of an enum specifier in dialects which permit fixed underlying types.
Fixes the rejects-valid part of PR10264.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134468 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the Python bindings for libclang in a few ways, from Eli
Douglas Gregor [Wed, 6 Jul 2011 03:00:34 +0000 (03:00 +0000)]
Improve the Python bindings for libclang in a few ways, from Eli
Bendersky. Specifically:

* Implemented a new function in libclang: clang_isAttribute

* Fixing TranslationUnit.get_includes to only go through the argument
* buffer when it contains something. This fixed a crash on Windows

* clang_getFileName returns CXString, not char*. Made appropriate
* fixes in cindex.py - now the relevant tests pass and we can see the
* full locations correctly again (previously there was garbage in
* place of the file name)
* Exposed clang_getCursorDisplayName to the python bindings

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134460 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSomehow the -fgnu-runtime option itself got lost in all that shuffling.
John McCall [Wed, 6 Jul 2011 02:36:30 +0000 (02:36 +0000)]
Somehow the -fgnu-runtime option itself got lost in all that shuffling.
Restore it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134459 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCall objc_terminate() instead of abort() when a cleanup throws an
John McCall [Wed, 6 Jul 2011 01:22:26 +0000 (01:22 +0000)]
Call objc_terminate() instead of abort() when a cleanup throws an
exception in Objective-C;  in Objective-C++ we still use std::terminate().
This is only available in very recent runtimes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134456 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMissing header from last commit; accidental change.
John McCall [Wed, 6 Jul 2011 00:38:59 +0000 (00:38 +0000)]
Missing header from last commit; accidental change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134455 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdded a missing case label.
Fariborz Jahanian [Wed, 6 Jul 2011 00:29:51 +0000 (00:29 +0000)]
Added a missing case  label.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134454 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange the driver's logic about Objective-C runtimes: abstract out a
John McCall [Wed, 6 Jul 2011 00:26:06 +0000 (00:26 +0000)]
Change the driver's logic about Objective-C runtimes:  abstract out a
structure to hold inferred information, then propagate each invididual
bit down to -cc1.  Separate the bits of "supports weak" and "has a native
ARC runtime";  make the latter a CodeGenOption.

The tool chain is still driving this decision, because it's the place that
has the required deployment target information on Darwin, but at least it's
better-factored now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134453 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: enforce performSelector rules in rejecting retaining selectors
Fariborz Jahanian [Tue, 5 Jul 2011 22:38:59 +0000 (22:38 +0000)]
objc-arc: enforce performSelector rules in rejecting retaining selectors
passed to it, and unknown selectors causing potential leak.
// rdar://9659270

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134449 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd the ObjC ARC optimization passes manually, now that they're not
Dan Gohman [Tue, 5 Jul 2011 22:02:36 +0000 (22:02 +0000)]
Add the ObjC ARC optimization passes manually, now that they're not
hardwired into the default pass list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134445 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove unused member of Builtin::Info.
Eli Friedman [Tue, 5 Jul 2011 21:53:01 +0000 (21:53 +0000)]
Remove unused member of Builtin::Info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134443 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTestcase for r134441.
Devang Patel [Tue, 5 Jul 2011 21:48:46 +0000 (21:48 +0000)]
Testcase for r134441.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134442 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDrop "soft" argument that would be considered as file argument by cc1.
Joerg Sonnenberger [Tue, 5 Jul 2011 19:52:46 +0000 (19:52 +0000)]
Drop "soft" argument that would be considered as file argument by cc1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134438 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoLook through parenthesized declarators when determining whether an
Douglas Gregor [Tue, 5 Jul 2011 18:30:26 +0000 (18:30 +0000)]
Look through parenthesized declarators when determining whether an
instantiated function template was written with a prototype or via
some kind of typedef. Fixes PR10273 / <rdar://problem/9723679>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134426 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHook up mipsel-netbsd and mipsel-freebsd for OS specific handling.
Joerg Sonnenberger [Tue, 5 Jul 2011 18:24:04 +0000 (18:24 +0000)]
Hook up mipsel-netbsd and mipsel-freebsd for OS specific handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134425 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse OS-specific configuration for mips-netbsd and mips-freebsd.
Joerg Sonnenberger [Tue, 5 Jul 2011 18:05:54 +0000 (18:05 +0000)]
Use OS-specific configuration for mips-netbsd and mips-freebsd.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134422 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSome documentation fixes for the parser, from John Freeman
Douglas Gregor [Tue, 5 Jul 2011 17:13:11 +0000 (17:13 +0000)]
Some documentation fixes for the parser, from John Freeman

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134419 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStringRef'ize clang::drive::Option::getName(), from Zach Wheeler!
Douglas Gregor [Tue, 5 Jul 2011 16:56:25 +0000 (16:56 +0000)]
StringRef'ize clang::drive::Option::getName(), from Zach Wheeler!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134418 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up and refactor ParseFunctionDeclarator to reduce code
Douglas Gregor [Tue, 5 Jul 2011 16:44:18 +0000 (16:44 +0000)]
Clean up and refactor ParseFunctionDeclarator to reduce code
repetition and better reflect the actual grammar, from John Freeman!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134417 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoActOnCXXConditionDeclaration should take into account that
Douglas Gregor [Tue, 5 Jul 2011 16:13:20 +0000 (16:13 +0000)]
ActOnCXXConditionDeclaration should take into account that
ActOnDeclarator can return NULL. Fixes PR10270, from Hans Wennborg!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134416 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't define __CONSTANT_CFSTRINGS__ with -fno-constant-cfstrings issue.
Fariborz Jahanian [Tue, 5 Jul 2011 16:00:59 +0000 (16:00 +0000)]
Don't define __CONSTANT_CFSTRINGS__ with -fno-constant-cfstrings issue.
Patch by Jean-Daniel Dupas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134414 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't define _BIG_ENDIAN for NetBSD/PowerPC.
Joerg Sonnenberger [Tue, 5 Jul 2011 14:56:12 +0000 (14:56 +0000)]
Don't define _BIG_ENDIAN for NetBSD/PowerPC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134411 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix indentation
Joerg Sonnenberger [Tue, 5 Jul 2011 14:54:41 +0000 (14:54 +0000)]
Fix indentation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134410 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach Clang's <float.h> to also include MinGW's <float.h>, which provides additional...
Douglas Gregor [Tue, 5 Jul 2011 14:17:04 +0000 (14:17 +0000)]
Teach Clang's <float.h> to also include MinGW's <float.h>, which provides additional system definitions, from Ruben Van Boxem

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134407 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate header-search paths for MinGW, from Ruben Van Boxem
Douglas Gregor [Tue, 5 Jul 2011 14:16:05 +0000 (14:16 +0000)]
Update header-search paths for MinGW, from Ruben Van Boxem

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134406 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't overread the buffer when an %x escape in inline asm ends prematurely.
Benjamin Kramer [Tue, 5 Jul 2011 11:13:37 +0000 (11:13 +0000)]
Don't overread the buffer when an %x escape in inline asm ends prematurely.

Tested by valgrind & Sema/asm.c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134404 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitialize member.
Benjamin Kramer [Tue, 5 Jul 2011 09:46:31 +0000 (09:46 +0000)]
Initialize member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134403 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd explicit default case for -Wswitch-enum.
Joerg Sonnenberger [Mon, 4 Jul 2011 23:11:58 +0000 (23:11 +0000)]
Add explicit default case for -Wswitch-enum.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134399 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse switch(os) style consistently. Add a bunch of NetBSD branches.
Joerg Sonnenberger [Mon, 4 Jul 2011 21:59:44 +0000 (21:59 +0000)]
Use switch(os) style consistently. Add a bunch of NetBSD branches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134393 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOn PowerPC, both FreeBSD and NetBSD use ints for (s)size_t
Joerg Sonnenberger [Mon, 4 Jul 2011 21:57:55 +0000 (21:57 +0000)]
On PowerPC, both FreeBSD and NetBSD use ints for (s)size_t

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134392 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove unused parameter from ActOnDeclarator.
Anders Carlsson [Mon, 4 Jul 2011 16:28:17 +0000 (16:28 +0000)]
Remove unused parameter from ActOnDeclarator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134377 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the Decl and Stmt stats printing to use llvm::errs() instead of
Chandler Carruth [Mon, 4 Jul 2011 06:13:27 +0000 (06:13 +0000)]
Switch the Decl and Stmt stats printing to use llvm::errs() instead of
fprintf, and to be more consistent in formatting with the other stats
printing routines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134374 91177308-0d34-0410-b5e6-96231b3b80d8