Commit Graph

8553 Commits

Author SHA1 Message Date
Fariborz Jahanian 71848a3ff1 Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.

llvm-svn: 82493
2009-09-21 23:03:37 +00:00
Ted Kremenek 25c9c1427a Provide intermediate solution to handling assignments to structs via an
integer pointer.  For now just invalidate the fields of the struct.

This addresses: <rdar://problem/7185607> [RegionStore] support invalidation of bit fields using integer assignment

llvm-svn: 82492
2009-09-21 22:58:52 +00:00
Douglas Gregor 9d64c5e3a5 Code completion for ordinary names when we're starting a declaration, expression, or statement
llvm-svn: 82481
2009-09-21 20:51:25 +00:00
Douglas Gregor 2af2f670d1 When providing a code-completion suggestion for a hidden name, include
a nested-name-specifier that describes how to refer to that name. For
example, given:

  struct Base { int member; };
  struct Derived : Base { int member; };

the code-completion result for a member access into "Derived" will
provide both "member" to refer to Derived::member (no qualification needed) and
"Base::member" to refer to Base::member (qualification included).

llvm-svn: 82476
2009-09-21 20:12:40 +00:00
Douglas Gregor f251067530 Enhance "case" code completion in C++ to suggest qualified names for
enumerators when either the user intentionally wrote a qualified name
(in which case we just use that nested-name-specifier to match
the user's code) or when this is the first "case" statement and we
need a qualified name to refer to an enumerator in a different scope.

llvm-svn: 82474
2009-09-21 19:57:38 +00:00
Fariborz Jahanian 38c3ae9bc4 Miscellanous fixes in generatation of objc gc's write-barriers.
llvm-svn: 82472
2009-09-21 18:54:29 +00:00
Douglas Gregor d328d57c39 Code completion for "case" statements within a switch on an expression
of enumeration type, providing the various unused enumerators as options.

llvm-svn: 82467
2009-09-21 18:10:23 +00:00
Douglas Gregor 3545ff43f4 Refactor and simplify the CodeCompleteConsumer, so that all of the
real work is performed within Sema. Addresses Chris's comments, but
still retains the heavyweight list-of-multimaps data structure.

llvm-svn: 82459
2009-09-21 16:56:56 +00:00
Daniel Dunbar 143021e0ca Add missing PCH support for -fstack-protector.
llvm-svn: 82435
2009-09-21 04:16:19 +00:00
Chris Lattner bf20638966 Implement __builtin_unreachable(), a GCC 4.5 extension.
llvm-svn: 82433
2009-09-21 03:09:59 +00:00
Daniel Dunbar b7bbfdd9e6 Change ASTUnit to only initialize the predefines buffer to the suggested predefines.
- It isn't really clear what to do with the preprocessor here, but this is more sensible.

llvm-svn: 82431
2009-09-21 03:03:47 +00:00
Daniel Dunbar 7cd285f0fe Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.
llvm-svn: 82430
2009-09-21 03:03:39 +00:00
Anders Carlsson a18322cea5 Start mangling expressions.
llvm-svn: 82423
2009-09-21 01:21:10 +00:00
Daniel Dunbar 9996138a80 Ok, an AssertingVH definitely doesn't work for now because we free our cache after the optimizer may have hacked on the module. Use a WeakVH instead.
llvm-svn: 82324
2009-09-19 20:17:48 +00:00
Nick Lewycky 41eaf0ac57 Make clang stop relying on ConstantStruct::get's default value for isPacked
which will be going away (ie. it's becoming a required parameter) later today.

llvm-svn: 82323
2009-09-19 20:00:52 +00:00
Daniel Dunbar 1cbaae56cf Switch CGDebugInfo type cache to using an AssertingVH.
llvm-svn: 82321
2009-09-19 19:27:24 +00:00
Daniel Dunbar de870bdcf2 Factor out CGDebugInfo::CreateTypeNode method.
- No functionality change.

llvm-svn: 82320
2009-09-19 19:27:14 +00:00
Douglas Gregor b5c738b434 In C++ code completion, only suggest the "template" keyword after ".",
"->", or "::" if we will be looking into a dependent context. It's not
wrong to use the "template" keyword, but it's to needed, either.

llvm-svn: 82307
2009-09-18 23:55:56 +00:00
Douglas Gregor ce23bae4f8 Make the construction of the code-completion string for a function
template smarter, by taking into account which function template
parameters are deducible from the call arguments. For example,

  template<typename RandomAccessIterator>
  void sort(RandomAccessIterator first, RandomAccessIterator last);

will have a code-completion string like

  sort({RandomAccessIterator first}, {RandomAccessIterator last})

since the template argument for its template parameter is
deducible. On the other hand,

  template<class X, class Y>
  X* dyn_cast(Y *Val);

will have a code-completion string like

  dyn_cast<{class X}>({Y *Val})

since the template type parameter X is not deducible from the function
call.

llvm-svn: 82306
2009-09-18 23:21:38 +00:00
Douglas Gregor 3f6ca38927 Introduce code completion patterns for templates, which provide the
angle brackets < > along with placeholder template arguments.

llvm-svn: 82304
2009-09-18 22:47:56 +00:00
Ted Kremenek 0ccd06c017 Re-introduce diagnostic caching in BugReporter that was originally added in
r82198 and then reverted. This is an intermediate solution, as diagnostic
caching should not rely on static variables.

llvm-svn: 82301
2009-09-18 22:37:37 +00:00
Ted Kremenek 3d8f862596 Reintroduce FoldingSet profiling for PathDiagnostics.
llvm-svn: 82299
2009-09-18 22:33:39 +00:00
Ted Kremenek 1e7f988f5e Fix regression introduced by r82198 that caused functions/methods with invalid CFGs to get analyzed.
llvm-svn: 82297
2009-09-18 22:29:35 +00:00
Douglas Gregor fedc328ae9 Introduce code completion strings, which describe how to *use* the
results of code completion, e.g., by providing function call syntax
with placeholders for each of the parameters.

llvm-svn: 82293
2009-09-18 22:15:54 +00:00
Anders Carlsson 82b688e423 More mangling work.
llvm-svn: 82265
2009-09-18 20:11:09 +00:00
Douglas Gregor c811ede9b7 C++ code completion after the "operator" keyword. Provide overloaded
operators, type specifiers, type names, and nested-name-specifiers.

llvm-svn: 82264
2009-09-18 20:05:18 +00:00
Anders Carlsson c3773bd669 Make the mangler conform even better to the grammar.
llvm-svn: 82262
2009-09-18 19:44:50 +00:00
Anders Carlsson 327c8df90c Make our char vector types not be explicitly signed to match GCC and to fix compilation with C++ and -fno-lax-vector-conversions
llvm-svn: 82254
2009-09-18 19:18:19 +00:00
Mike Stump f9c95be2f6 Generate more of the vbase virtual offset for covariant thunks. WIP.
llvm-svn: 82253
2009-09-18 19:06:35 +00:00
Douglas Gregor 7e90c6db18 Introduce four new code-completion hooks for C++:
- after "using", show anything that can be a nested-name-specifier.
  - after "using namespace", show any visible namespaces or namespace aliases
  - after "namespace", show any namespace definitions in the current scope
  - after "namespace identifier = ", show any visible namespaces or
    namespace aliases

llvm-svn: 82251
2009-09-18 19:03:04 +00:00
Anders Carlsson 559d9741a8 More mangler mangling.
llvm-svn: 82250
2009-09-18 19:00:18 +00:00
Anders Carlsson caf4a646f8 Call mangleTemplatePrefix.
llvm-svn: 82247
2009-09-18 18:47:07 +00:00
Anders Carlsson c1370cb49b Change manglePrefix to return early if the DC is the translation unit.
llvm-svn: 82246
2009-09-18 18:39:58 +00:00
Douglas Gregor 2ecab75739 Don't perform name lookup into a given declaration context more than once during code completion
llvm-svn: 82234
2009-09-18 18:07:23 +00:00
Douglas Gregor 56c2dbcfe7 Handle using declarations and overload sets in code completion.
llvm-svn: 82233
2009-09-18 17:54:00 +00:00
Douglas Gregor 945e8d9762 For code completion in C++ member access expressions and tag names,
look into the current scope for anything that could start a
nested-names-specifier. These results are ranked worse than any of the
results actually found in the lexical scope.

Perform a little more pruning of the result set, eliminating
constructors, __va_list_tag, and any duplication of declarations in
the result set. For the latter, implemented
NamespaceDecl::getCanonicalDecl.

llvm-svn: 82231
2009-09-18 17:42:29 +00:00
Anders Carlsson dfa3117085 Fix PR4923.
Fix error in _mm_set_pd/_mm_setr_pd and add _mm_set_epi64x/_mm_set1_epi64x. Patch by Laurent Morichetti!

llvm-svn: 82228
2009-09-18 17:03:55 +00:00
Douglas Gregor 2da11086f3 When gathering results for code completion, only include hidden
results when there is some way to refer to them in the language, such
as with a qualified name in C++.

llvm-svn: 82223
2009-09-18 15:51:54 +00:00
Douglas Gregor f45b0cf389 Implement code completion for tags, e.g., code completion after "enum"
will provide the names of various enumerations currently
visible. Introduced filtering of code-completion results when we build
the result set, so that we can identify just the kinds of declarations
we want.

This implementation is incomplete for C++, since we don't consider
that the token after the tag keyword could start a
nested-name-specifier. 

llvm-svn: 82222
2009-09-18 15:37:17 +00:00
Daniel Dunbar ebc5140e22 Disable questionable code for handling isNullPointerConstant on value dependent
expression.

llvm-svn: 82217
2009-09-18 08:46:16 +00:00
Daniel Dunbar 6276f99be5 Split Darwin toolchain into Clang and GCC Darwin toolchains with a common base.
llvm-svn: 82213
2009-09-18 08:15:13 +00:00
Daniel Dunbar 26d482a1a9 Lift AddLinkRuntimeLibArgs into Darwin tool chain.
llvm-svn: 82212
2009-09-18 08:15:03 +00:00
Daniel Dunbar d5bd81e869 Move isMacosxVersionLT helpers to Darwin tool chain.
llvm-svn: 82211
2009-09-18 08:14:55 +00:00
Daniel Dunbar 510d8a8dd8 Lift getMacosxVersionMin out into Darwin ToolChain.
llvm-svn: 82210
2009-09-18 08:14:46 +00:00
Daniel Dunbar 4c30b89def Lift AddLinkerSearchPaths() into Darwin tool chain.
llvm-svn: 82209
2009-09-18 08:14:36 +00:00
Daniel Dunbar 48622c13f7 Rename a variable to match its semantics.
llvm-svn: 82208
2009-09-18 08:14:24 +00:00
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
Chris Lattner 01ce06fbbc don't stick an uninitialized 'stat' buf into the stat cache, fill it
with zeros.  This avoids a GCC warning (PR5000)

llvm-svn: 82194
2009-09-18 04:51:01 +00:00
Anders Carlsson 2b5e1dda69 More mangling goodness.
llvm-svn: 82193
2009-09-18 04:29:09 +00:00