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

21209 Коммитов

Автор SHA1 Сообщение Дата
Argyrios Kyrtzidis 144b38a799 [PCH] Fix a regression that r139441 introduced (decls were getting passed
to the consumer without being fully deserialized).

The regression was on compiling boost.python and it was too difficult to get a reduced
test case unfortunately.

Also modify the logic of how objc methods are getting passed to the consumer;
codegen depended on receiving objc methods before the implementation decl.
Since the interesting objc methods are ones with a body and such methods only
exist inside an ObjCImplDecl, deserialize and pass to consumer all the methods
of ObCImplDecl when we see one.

Fixes http://llvm.org/PR10922 & rdar://10117105.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139644 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 21:35:00 +00:00
Eli Friedman 93013b2356 Make clang use Acquire loads and Release stores where necessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139643 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 21:31:32 +00:00
Eli Friedman de24d44665 Turn off the generation of unaligned atomic load/store; I'm going to explicitly error out on such cases in the backend, at least for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 20:48:30 +00:00
Douglas Gregor 1c7e0472f5 When building a module on-demand, clear out the "non-modular" language
and preprocessor options (such as macro definitions) first.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139638 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 20:44:41 +00:00
Argyrios Kyrtzidis f1e7af36d6 Add the location of the interface reference to IBOutletCollectionAttr.
Depends on a llvm tablegen commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 18:41:59 +00:00
John McCall 265941bc30 Refactoring, mostly to give ObjCPropertyDecls stronger invariants for
their semantic attributes and then to take advantage of that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139615 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 18:31:23 +00:00
Douglas Gregor 7d5e81bf24 Switch the serialization of LangOptions over to use the .def file. We
should no longer have the serialization of LangOptions out of sync
with the structure itself (yay).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139613 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 18:26:39 +00:00
Caitlin Sadowski e87158dfbc Thread safety: Initializing var before exhaustive switch statement to deal with extraneous warning produced by gcc but not clang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139611 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 18:01:58 +00:00
Douglas Gregor e289d81369 Switch LangOptions over to a .def file that describes header of the
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.

AST serialization changes are next up.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139605 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 17:21:33 +00:00
Argyrios Kyrtzidis 768d6cae40 Keep the source range of attributes. Depends on a llvm tablegen commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139600 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 16:05:58 +00:00
Argyrios Kyrtzidis ffcc3105d2 Record the full source range of an attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139599 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 16:05:53 +00:00
Francois Pichet c985b88efc In Microsoft mode, downgrade "goto into protected scope" from error to warning if we are jumping over a variable initialization via a goto.
This fixes a few errors when parsing MFC code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139595 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 10:26:51 +00:00
Chandler Carruth e05ee6df35 Switch -Wreturn-type to completely rely on the CFG model of no-return.
This deletes a bunch of crufty code, and allows more logic sharing
between the analyzer and the warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139594 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 09:53:58 +00:00
Chandler Carruth 83754162f6 Add a bit to the CFGBlock to track when it contains a no-return
CFGElement. This will allow greatly simplifying the logic in
-Wreturn-type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139593 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 09:53:55 +00:00
Chandler Carruth dba3fb5413 Consolidate the logic for building a no-return CFG block into a single
location with a single comment rather than scattering it in three
places.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139592 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 09:13:49 +00:00
John McCall c5d9a90b3a Don't use native atomics on ivars whose size is not a power of two,
even on architectures that support unaligned access (which is the
only way this is otherwise legal, given that ivars apparently do
not honor alignment attributes).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139590 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 07:33:34 +00:00
Chandler Carruth c8cfc74bdc Enhance the CFG construction to detect no-return destructors for
temporary objects and local variables. When detected, these split the
block, marking the new one as having only the exit block as a successor.
This prevents a large number of false positives in warnings sensitive to
no-return constructs such as -Wreturn-type, and fixes the remainder of
PR10063 along with several variations of this bug that had not been
reported. The test cases are extended across the board to cover these
patterns.

This also checks in a stress test for these types of CFGs. The stress
test declares some 32k variables, a mixture of no-return and normal
destructors. Previously, this resulted in roughly 2500 CFG blocks, but
didn't model any of the no-return destructors. With this patch, it
results in over 33k blocks, many of them now unreachable.

The nice thing about how the analyzer is set up? This causes *no*
regression in performance of building the CFG. It actually in some cases
makes it faster, as best I can benchmark. The analysis for -Wreturn-type
(and any other that cares about no-return code paths) is technically
slower now as it has to look at many more candidate blocks, but it
computes the correct answer. I have more test cases to follow, I think
they all work now. Also I have further work that should dramatically
simplify analyses in the presence of no-return.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139586 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 06:09:01 +00:00
John McCall 6c11f0b310 Handle reference properties correctly in the trivial-getter check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139585 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 06:00:03 +00:00
John McCall 5889c60d19 Always emit bitfield properties using expression behavior, even if they're
atomic.  This is probably something we should warn about.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139584 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 05:36:29 +00:00
John McCall 1e1f487153 Unify the decision of how to emit property getters and setters into a
single code path.  Use atomic loads and stores where necessary.  Load and
store anything of the appropriate size and alignment with primitive
operations instead of going through the call.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139580 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 03:34:09 +00:00
Douglas Gregor 78243658c5 When compiling a module on-demand, re-use the diagnostics client
already provided. This required a little bit of clean-up in the way
that VerifyDiagnosticsClient managed ownership of its underlying
"primary" client, because now it will no longer always take ownership.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139570 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 01:26:44 +00:00
Douglas Gregor 21cae2059a When an import statement fails to find a module in the module cache,
but there is a corresponding umbrella header in a framework, build the
module on-the-fly so it can be immediately loaded at the import
statement. This is very much proof-of-concept code, with details to be
fleshed out over time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 23:31:24 +00:00
John McCall 41bdde9e96 Privatize the setter/getter call generation methods, plus some minor
modernization.  No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139555 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 23:06:44 +00:00
Caitlin Sadowski 7613c73af8 Thread safety: small formatting change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 22:28:41 +00:00
Douglas Gregor 9a6da69306 Introduce a cc1-level option to provide the path to the module cache,
where the compiler will look for module files. Eliminates the
egregious hack where we looked into the header search paths for
modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 20:41:59 +00:00
Douglas Gregor 48822fbd08 Kill off an irrelevant FIXME
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139523 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:58:37 +00:00
Devang Patel e7566cf6e1 By popular demand, enumerate all builtin types!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:50:21 +00:00
Richard Trieu 6eef9fb34c Refactor CheckAdditionOperands() to use early return for pointer addition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:37:54 +00:00
Douglas Gregor e389585f8a Diagnose attempt to mark function-local declarations as __module_private__.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:37:38 +00:00
Devang Patel 3d3aa19232 Add an assert so that new builtins do not sneak without proper debug info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139514 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:24:46 +00:00
Argyrios Kyrtzidis 26d43cd3a0 [libclang] In ASTUnit::Parse copy the CompilerInvocation object instead of
modifying directly for the preamble.

This avoids an awful, hard to find, bug where "PreprocessorOpts.DisablePCHValidation = true"
would be persistent for subsequent reparses of the translation unit which would result
in defines, present in command-line but not in the PCH, being ignored.

Fixes rdar://9615399.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139512 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:09:38 +00:00
Richard Trieu d9f1934bd0 Fix two comments from warn to emit error to match the actual diagnostic used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139510 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:08:02 +00:00
Anna Zaks 7a756463ff [analyzer] Fix a failure encountered while analyzing bind (radar://10105448).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:07:30 +00:00
Anna Zaks f7afe4abd2 [analyzer] Fix a new failure encountered while building Adium exposed as a result of r138196(radar://10087620). ObjectiveC property of type int has a value of type ObjCPropRef, which is a Loc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139507 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 17:56:08 +00:00
Devang Patel e8ee3f2cda Fix debug info encodings for char16_t and char32_t.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 17:11:58 +00:00
Douglas Gregor 591dc84101 Allow __module_private__ on fields
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139499 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 16:11:24 +00:00
Douglas Gregor f3a762a8de Remove the restriction on module-private friends. Since the friend
declaration may be the first declaration, we want the ability to that
declaration to be marked module-private.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139497 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 15:48:15 +00:00
Douglas Gregor eced60c185 Only predefine the __EXCEPTIONS macro if C++ exceptions are turned on.
Only predefine the OBJC_ZEROCOST_EXCEPTIONS macro if Objective-C
exceptions are turned on. Fixes PR10910.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139496 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 15:17:19 +00:00
Hans Wennborg cb4d7c202e Silence ?: precendence warning when parenthesis are present.
Fixes PR10898. The warning should be silent when there are parenthesis
around the condition expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139492 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 12:07:30 +00:00
Benjamin Kramer afc5b15022 Silence "end of non-void function" warnings with llvm_unreachable and add an assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139474 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 21:52:04 +00:00
Fariborz Jahanian 3a448fb539 objc rewriter - more fixes to support compiling the rewritten
test case having instancetype. Fix in rewriter is unrelated to
using of instancetype. Test case uses other feature not yet
supported in the rewriter. There is more work to do, but this
is an ongoing task and not urgent at this time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139473 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 17:01:56 +00:00
Chris Lattner a2f4ae8cfa remove pedantic ;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139472 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 16:13:42 +00:00
John McCall bbb253c307 Modernize and comment; no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139470 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 09:30:49 +00:00
John McCall 71c758d3f4 Simplify the generation of Objective-C setters, at least a little.
Use a more portable heuristic for deciding when to emit a single
atomic store;  it's possible that I've lost information here, but
I'm not sure how much of the logic before was intentionally arch-specific
and how much was just not quite consistent.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 09:17:20 +00:00
John McCall 33e56f3273 Rename the ARC cast kinds to start with "ARC".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139466 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 06:18:15 +00:00
David Blaikie 4f4f349208 Show either a location or a fixit note, not both, for uninitialized variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139463 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 05:35:08 +00:00
Richard Trieu a81b36d7bc Fix a broken assert in AST/DeclCXX.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139461 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 02:16:48 +00:00
John McCall dc05b11c67 When converting a block pointer to an Objective-C pointer type, extend
the lifetime of the block by copying it to the heap, or else we'll get
a dangling reference because the code working with the non-block-typed
object will not know it needs to copy.

There is some danger here, e.g. with assigning a block literal to an
unsafe variable, but, well, it's an unsafe variable.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139451 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 01:16:55 +00:00
Douglas Gregor b3321093f6 Fix a diagnostics crasher with -Wmissing-noreturn in Objective-C
methods, and improve the diagnostic slightly along the way. Fixes
<rdar://problem/10098695>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139446 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 00:56:20 +00:00
Chandler Carruth 78bf680ddf Fix a -Wreturn-type warning due to this field not explicitly having the
enumeration type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 00:51:24 +00:00