Commit Graph

4454 Commits

Author SHA1 Message Date
Ted Kremenek e3d209ff77 Revert most of r82198, which was causing a large number of crashes
when running the analyzer on real projects.  We'll keep the change to
AnalysisManager.cpp in r82198 so that -fobjc-gc analyzes code
correctly in both GC and non-GC modes, although this may emit two
diagnostics for each bug in some cases (a better solution will come
later).

llvm-svn: 82201
2009-09-18 07:31:15 +00:00
Ted Kremenek 82f7f9c080 Introduce caching of diagnostics in BugReporter. This provides extra
pruning of diagnostics that may be emitted multiple times.  This is
accomplished by adding FoldingSet profiling support to PathDiagnostic,
and then having BugReporter record what diagnostics have been issued.

This was motived to a serious bug introduced by moving the
'divide-by-zero' checking outside of GRExprEngine into a separate
'Checker' class.  When analyzing code using the '-fobjc-gc' option, a
given function would be analyzed twice, but the second time various
"internal checks" would be disabled to avoid emitting multiple
diagnostics (e.g., "null dereference") for the same issue.  The
problem is that such checks also effect path pruning and don't just
emit diagnostics.  This resulted in an assertion failure involving a
real divide-by-zero in some analyzed code where we would get an
assertion failure in APInt because the 'DivZero' check was disabled
and didn't prune the logic that resulted in the divide-by-zero in the
analyzer.

The implemented solution is somewhat of a hack, and may not perform
extremely well.  This will need to be cleaned up over time.

As a regression test, 'misc-ps.m' has been modified so that its tests
are run using -fobjc-gc to test this diagnostic pruning behavior.

llvm-svn: 82198
2009-09-18 05:37:41 +00:00
Anders Carlsson 2b5e1dda69 More mangling goodness.
llvm-svn: 82193
2009-09-18 04:29:09 +00:00
Anders Carlsson adb08de4d9 Fix error in test.
llvm-svn: 82190
2009-09-18 02:51:58 +00:00
Anders Carlsson 7a8a74f704 Handle mangling of TemplateSpecializationType.
llvm-svn: 82189
2009-09-18 02:42:01 +00:00
Fariborz Jahanian 2e32ddc7ba Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.

llvm-svn: 82183
2009-09-18 00:04:00 +00:00
Douglas Gregor 2436e7116b Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".

llvm-svn: 82166
2009-09-17 21:32:03 +00:00
Daniel Dunbar ecac0a408c Tweak clang testing.
- Move CMake to using the new test runner.

 - Switch Makefiles to use the lit.site.cfg.in template.

 - Remove explicit --path arguments, instead this gets written into the site
   configuration. This means running lit from the command line should use the
   exact same configuration as is used in 'make test', assuming it can find the
   site configuration file. You still need to run 'make test' (or the cmake
   build target equivalent) at least once.

llvm-svn: 82160
2009-09-17 19:55:53 +00:00
Douglas Gregor 4f15f4dec1 Merge uninstantiated default arguments more carefully, and try not to
complain about specializations of member functions that are not
definitions. Fixes PR4995.

llvm-svn: 82159
2009-09-17 19:51:30 +00:00
Anders Carlsson ca51ef156b Ignore extern "C++" { } when mangling.
llvm-svn: 82146
2009-09-17 16:12:20 +00:00
Daniel Dunbar 51418c3b90 Force triple for tests using __strong.
llvm-svn: 82133
2009-09-17 07:21:40 +00:00
Daniel Dunbar 1da76c4e58 Add ARM register names and aliases.
- Patch by Shantonu Sen!

<rdar://problem/6922650> clang doesn't know about ARM registers for inline asm clobber lists

llvm-svn: 82132
2009-09-17 07:03:19 +00:00
Daniel Dunbar 687fa86a30 Fix two crashes on value dependent expressions (shift and null-pointer check).
- Doug, please check.

 - PR4940.

llvm-svn: 82129
2009-09-17 06:31:27 +00:00
Anders Carlsson f96da57adb Revert r82123 for now.
llvm-svn: 82125
2009-09-17 05:31:47 +00:00
Anders Carlsson 93b6d5e85e Temporary band-aid for handling empty classes somewhat better.
llvm-svn: 82124
2009-09-17 04:42:56 +00:00
Anders Carlsson 49fe8b4f97 Treat an unqualified RecordType as a RecordDecl when substituting.
llvm-svn: 82123
2009-09-17 04:38:23 +00:00
Anders Carlsson 4245bf9e13 Substitution for prefixes.
llvm-svn: 82122
2009-09-17 04:16:28 +00:00
Anders Carlsson 90332b8db4 Convert mangle-subst.cpp over to using FileCheck.
llvm-svn: 82121
2009-09-17 04:13:54 +00:00
Anders Carlsson a2fb9bcd19 Substitute unscoped template names.
llvm-svn: 82119
2009-09-17 04:02:31 +00:00
Daniel Dunbar df0e62d0a1 IRgen/ObjC: Correctly construct the function info for variadic message sends.
This fixes some bad -O0 codegen and the unnecessary clearing of al on entry to objc_msgSend for most message sends.

<rdar://problem/7102824> [irgen] unnecessary xorb on calls to objc_msgSend on x86_64

llvm-svn: 82118
2009-09-17 04:01:40 +00:00
Anders Carlsson 3e0d1e0747 Get rid of the last grep.
llvm-svn: 82115
2009-09-17 03:48:45 +00:00
Anders Carlsson df644fb773 When mangling function template specialization, mangle the type encoding of the original function template. Also, port mangle.cpp and function-template-specialization.cpp over to using FileCheck.
llvm-svn: 82114
2009-09-17 03:46:43 +00:00
Daniel Dunbar e9fee8a361 Initial support for code generation from .ast files.
- Doesn't actually work yet because only module level asm's get correctly marked as externally visible in the PCH.

 - Other things like 'clang-cc foo.ast -ast-dump' now work, as well.

llvm-svn: 82107
2009-09-17 00:48:13 +00:00
Daniel Dunbar 1188987e23 clang-cc: Remove -ObjC -ObjC++ handling from clang-cc.
llvm-svn: 82103
2009-09-17 00:47:27 +00:00
Anders Carlsson feb60501a8 Add basic substitution to the C++ mangler. It currently only looks at types.
llvm-svn: 82102
2009-09-17 00:43:46 +00:00
Daniel Dunbar db7ec04fed Force triple, although probably the real fix is to tie __strong to -fobjc-gc.
llvm-svn: 82101
2009-09-17 00:28:00 +00:00
Daniel Dunbar 6f8f276ce4 Fix substituto.
llvm-svn: 82099
2009-09-17 00:07:21 +00:00
Anders Carlsson b3e533d9d0 Add a simple const mangling test.
llvm-svn: 82096
2009-09-16 23:53:19 +00:00
Fariborz Jahanian 1ff8299c67 Removed useless stuff from the test.
llvm-svn: 82095
2009-09-16 23:52:53 +00:00
Fariborz Jahanian 0bdc001b6e More test for objc gc's mixed write-barriers.
llvm-svn: 82094
2009-09-16 23:49:04 +00:00
Anders Carlsson e7e163cc0b When creating function types, remove any top-level CVR qualifications in the function type argument types.
llvm-svn: 82093
2009-09-16 23:47:08 +00:00
Fariborz Jahanian e29f04859b Additional tests for write-bariers.
llvm-svn: 82092
2009-09-16 23:38:26 +00:00
Fariborz Jahanian 5f41a8c4af Test for variety of write-barriers.
llvm-svn: 82091
2009-09-16 23:30:59 +00:00
Fariborz Jahanian de1d324dce patch for generating objc'2 objc_assign_ivar. WIP.
llvm-svn: 82090
2009-09-16 23:11:23 +00:00
John McCall 11083da4d0 Improved representation and support for friend class templates. Angst about same.
llvm-svn: 82088
2009-09-16 22:47:08 +00:00
Douglas Gregor 8addadc691 CMake: Generate LIT site configuration file for Clang tests, which Daniel will probably have to fix
llvm-svn: 82086
2009-09-16 22:30:48 +00:00
Fariborz Jahanian a7fa6beb2e Starting patch to generate more specific API for objc's
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.

llvm-svn: 82082
2009-09-16 21:37:16 +00:00
Anders Carlsson 570af5d426 Improve handling of vector casts in C++.
llvm-svn: 82072
2009-09-16 19:19:43 +00:00
Douglas Gregor 64621e6eb3 Teach Sema::FindInstantiatedDecl to find instantiated RecordDecls even
when we are not instantiating the corresponding "current
instantiation." This happens, e.g., when we are instantiating a
declaration reference that refers into the "current instantiation" but
occurs in a default function argument. The libstdc++ vector default
constructor now instantiates properly.

llvm-svn: 82069
2009-09-16 18:34:49 +00:00
Fariborz Jahanian cceedbff27 Do not generate write-barrier in indirect assignment to
a weak object.

llvm-svn: 82061
2009-09-16 18:09:18 +00:00
Anders Carlsson 20759ad54c x86-64 ABI: If a type is a C++ record with either a non-trivial destructor or a non-trivial copy constructor, it should be passed in a pointer. Daniel, plz review.
llvm-svn: 82050
2009-09-16 15:53:40 +00:00
Ted Kremenek 4f335c300a Have divide-by-zero checker not handled undefined denominators. This is handled by the generic checking for undefined operands for BinaryOperators.
llvm-svn: 82019
2009-09-16 06:04:26 +00:00
Daniel Dunbar f47fd58476 tests: Stash clang/clang-cc and LLVM src/obj paths for use elsewhere.
llvm-svn: 81989
2009-09-16 01:39:52 +00:00
Mike Stump 1d0da3932e Some people don't want to fix their broken code just yet, so turn off
hard error for falling off a noreturn function.

llvm-svn: 81971
2009-09-16 00:39:34 +00:00
Douglas Gregor 87f5406081 When implicitly declaring operators new, new[], delete, and delete[],
give them the appropriate exception specifications. This,
unfortunately, requires us to maintain and/or implicitly generate
handles to namespace "std" and the class "std::bad_alloc". However,
every other approach I've come up with was more hackish, and this
standard requirement itself is quite the hack.

Fixes PR4829.

llvm-svn: 81939
2009-09-15 22:30:29 +00:00
Fariborz Jahanian adcea10410 1) don't do overload resolution in selecting conversion
to pointer function for delete expression. 2)
Treat type conversion function and its 'const' version
as identical in building the visible conversion list.

llvm-svn: 81930
2009-09-15 22:15:23 +00:00
Anders Carlsson c8bfc466f3 Add back the workaround since it lead to constructor conversion bugs :(
llvm-svn: 81917
2009-09-15 21:14:33 +00:00
Douglas Gregor 45068b3e29 Commit test case from PR4655, which tests the canonical-types fix in r81913
llvm-svn: 81916
2009-09-15 21:14:05 +00:00
Douglas Gregor 4fb9cde8ef When printing an overload candidate that is a function template specialization,
point at the template and print out its template arguments, e.g.,

ambiguous-ovl-print.cpp:5:8: note: candidate function template specialization
      [with T = int]
  void f(T*, long);

llvm-svn: 81907
2009-09-15 20:11:42 +00:00
Fariborz Jahanian 3e6b57e593 Issue good diagnostics when initialization failes due to
ambiguity in type conversion function selection.

llvm-svn: 81898
2009-09-15 19:12:21 +00:00