Commit Graph

32449 Commits

Author SHA1 Message Date
Douglas Gregor 79a91418bd 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.

llvm-svn: 139605
2011-09-13 17:21:33 +00:00
Chad Rosier dc2b8269d6 [driver] Add follow up comment for r139551 to ensure the unused option is not
removed in the future.
rdar://10110352 and PR10908

llvm-svn: 139602
2011-09-13 16:46:01 +00:00
Argyrios Kyrtzidis 309b4c49e4 Keep the source range of attributes. Depends on a llvm tablegen commit.
llvm-svn: 139600
2011-09-13 16:05:58 +00:00
Argyrios Kyrtzidis 635a9b4dcf Record the full source range of an attribute.
llvm-svn: 139599
2011-09-13 16:05:53 +00:00
Douglas Gregor a057a58048 Add a struct-size check for modules when dealing with module-private fields
llvm-svn: 139597
2011-09-13 15:37:05 +00:00
Francois Pichet 051f5e5cba 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.

llvm-svn: 139595
2011-09-13 10:26:51 +00:00
Chandler Carruth 03faf78953 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.

llvm-svn: 139594
2011-09-13 09:53:58 +00:00
Chandler Carruth 75d78232fd 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.

llvm-svn: 139593
2011-09-13 09:53:55 +00:00
Chandler Carruth a70991bb3f 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.

llvm-svn: 139592
2011-09-13 09:13:49 +00:00
John McCall 0bef0badf6 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).

llvm-svn: 139590
2011-09-13 07:33:34 +00:00
John McCall 69cdcec11f This test seems pretty low-value.
llvm-svn: 139589
2011-09-13 07:24:27 +00:00
Chandler Carruth ad74725ab5 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.

llvm-svn: 139586
2011-09-13 06:09:01 +00:00
John McCall bdd8185e22 Handle reference properties correctly in the trivial-getter check.
llvm-svn: 139585
2011-09-13 06:00:03 +00:00
John McCall 0e5c086de4 Always emit bitfield properties using expression behavior, even if they're
atomic.  This is probably something we should warn about.

llvm-svn: 139584
2011-09-13 05:36:29 +00:00
John McCall f4528ae063 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.

llvm-svn: 139580
2011-09-13 03:34:09 +00:00
Douglas Gregor 2b9b464290 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.

llvm-svn: 139570
2011-09-13 01:26:44 +00:00
Douglas Gregor faeb1d4658 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.

llvm-svn: 139558
2011-09-12 23:31:24 +00:00
John McCall b923ece770 Privatize the setter/getter call generation methods, plus some minor
modernization.  No functionality change.

llvm-svn: 139555
2011-09-12 23:06:44 +00:00
Chad Rosier c0f3e383c9 [driver] Ignore the '--' option, rather then fail. Do so to match gcc's
behavior.
rdar://10110352 and PR10908

llvm-svn: 139551
2011-09-12 22:43:01 +00:00
Anna Zaks ea8f5725c5 [analyzer] CmpRuns can now optionally delete empty reports.
llvm-svn: 139550
2011-09-12 22:40:36 +00:00
Caitlin Sadowski eecd273951 Thread safety: small formatting change
llvm-svn: 139548
2011-09-12 22:28:41 +00:00
Argyrios Kyrtzidis 01e3c590ae [libclang] For getDeclFromExpr in CIndex.cpp, associate the decl of
a DeclRefExpr, MemberExpr, etc. with a CastExpr if it is ImplicitCast,
since the implicit cast is the one that is invisible in source code.

llvm-svn: 139547
2011-09-12 22:17:26 +00:00
Anna Zaks b80d836137 [analyzer] CmpRuns.cmpScanBuildResults() should be easy to call from other modules.
llvm-svn: 139543
2011-09-12 21:32:41 +00:00
Anna Zaks 03f3598ff1 Rename CmpRuns into CmpRuns.py so that it could be used as a module.
llvm-svn: 139540
2011-09-12 21:07:18 +00:00
Douglas Gregor 1e44e02292 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.

llvm-svn: 139538
2011-09-12 20:41:59 +00:00
Douglas Gregor 7bfedd69c5 Kill off an irrelevant FIXME
llvm-svn: 139523
2011-09-12 18:58:37 +00:00
Devang Patel b0fa5b57ac By popular demand, enumerate all builtin types!
llvm-svn: 139521
2011-09-12 18:50:21 +00:00
Richard Trieu b420bcaeb0 Refactor CheckAdditionOperands() to use early return for pointer addition.
llvm-svn: 139520
2011-09-12 18:37:54 +00:00
Douglas Gregor 41866816ce Diagnose attempt to mark function-local declarations as __module_private__.
llvm-svn: 139519
2011-09-12 18:37:38 +00:00
Anna Zaks 05dda473e6 [analyzer] Simplify the test, use generic/more descriptive names.
llvm-svn: 139516
2011-09-12 18:28:35 +00:00
Devang Patel 33e097b699 Add an assert so that new builtins do not sneak without proper debug info.
llvm-svn: 139514
2011-09-12 18:24:46 +00:00
Devang Patel ba15240e83 Update test to fix windows buildbot.
llvm-svn: 139513
2011-09-12 18:11:52 +00:00
Argyrios Kyrtzidis 14c32e8894 [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.

llvm-svn: 139512
2011-09-12 18:09:38 +00:00
Argyrios Kyrtzidis 3405baa3f0 [libclang] Make c-index-test check CINDEXTEST_REMAP_AFTER_TRIAL environment variable,
which when set it determines the trial number after which the remapping of files should
take effect.

llvm-svn: 139511
2011-09-12 18:09:31 +00:00
Richard Trieu 993f3ab07b Fix two comments from warn to emit error to match the actual diagnostic used.
llvm-svn: 139510
2011-09-12 18:08:02 +00:00
Anna Zaks 79301b16f3 [analyzer] Fix a failure encountered while analyzing bind (radar://10105448).
llvm-svn: 139509
2011-09-12 18:07:30 +00:00
Anna Zaks 6e05e32e12 Doxygen comments.
llvm-svn: 139508
2011-09-12 17:57:20 +00:00
Anna Zaks 295208d744 [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.
llvm-svn: 139507
2011-09-12 17:56:08 +00:00
Anna Zaks 964c186ffe [analyzer] Test for -analyze-function on ObjectiveC to accompany r139439.
llvm-svn: 139506
2011-09-12 17:48:08 +00:00
Devang Patel 98ca8aeca6 Fix debug info encodings for char16_t and char32_t.
llvm-svn: 139502
2011-09-12 17:11:58 +00:00
Douglas Gregor 3baa6702ab Allow __module_private__ on fields
llvm-svn: 139499
2011-09-12 16:11:24 +00:00
Douglas Gregor fc33bcfc4a 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.

llvm-svn: 139497
2011-09-12 15:48:15 +00:00
Douglas Gregor b63ab9477c 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.

llvm-svn: 139496
2011-09-12 15:17:19 +00:00
Hans Wennborg be207b3c74 Silence ?: precendence warning when parenthesis are present.
Fixes PR10898. The warning should be silent when there are parenthesis
around the condition expression.

llvm-svn: 139492
2011-09-12 12:07:30 +00:00
Benjamin Kramer 8a8051f2cd Silence "end of non-void function" warnings with llvm_unreachable and add an assert.
llvm-svn: 139474
2011-09-10 21:52:04 +00:00
Fariborz Jahanian 9f0bc5757c 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.

llvm-svn: 139473
2011-09-10 17:01:56 +00:00
Chris Lattner d2cd41c5bf remove pedantic ;
llvm-svn: 139472
2011-09-10 16:13:42 +00:00
John McCall 6acaef9fe8 Modernize and comment; no functionality change.
llvm-svn: 139470
2011-09-10 09:30:49 +00:00
John McCall 7f16c42b9e 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.

llvm-svn: 139468
2011-09-10 09:17:20 +00:00
John McCall 2d637d2e79 Rename the ARC cast kinds to start with "ARC".
llvm-svn: 139466
2011-09-10 06:18:15 +00:00