Commit Graph

19581 Commits

Author SHA1 Message Date
Douglas Gregor 52ce62f069 Improve the sorting of code-completion results. We now always sort by
the "typed" text, first, then take into account
nested-name-specifiers, name hiding, etc. This means that the
resulting sort is actually alphabetical :)

llvm-svn: 93370
2010-01-13 23:24:38 +00:00
John McCall e8c8cd2a58 Don't report ambiguities in the user-defined conversion if we weren't supposed
to be considering user-defined conversions in the first place.

Doug, please review;  I'm not sure what we should be doing if we see a real
ambiguity in selecting a copy constructor when otherwise suppressing
user-defined conversions.

Fixes PR6014.

llvm-svn: 93365
2010-01-13 22:30:33 +00:00
John McCall 02bc54d11c Don't a.k.a. through the primary typedef of an anonymous tag decl.
llvm-svn: 93362
2010-01-13 22:07:44 +00:00
Douglas Gregor 48d462573d Code-completion for @public, @protected, @private, @package.
llvm-svn: 93361
2010-01-13 21:54:15 +00:00
Ted Kremenek d5c6eafe09 Reorganize CIndex.cpp into clearer sections of functions, and add a utility function 'MakeCXCursor' to centralize the logic for creating CXCursor objects.
llvm-svn: 93359
2010-01-13 21:46:36 +00:00
Fariborz Jahanian d0bbf66895 Fixes a rewrite bug rewriting a block call argument which has a trvial
constructor. Fixes radar 7537770.

llvm-svn: 93358
2010-01-13 21:41:11 +00:00
Douglas Gregor f193416359 Whenever completing ordinary names for an Objective-C source, also
provide completions for @ keywords. Previously, we only provided
@-completions after an @ was actually typed, which is useful but
probably not the common case.

Also, make sure a few Objective-C 2.0 completions only show up when
Objective-C 2.0 support is enabled (the default).

llvm-svn: 93354
2010-01-13 21:24:21 +00:00
Mike Stump 6f0bf82622 Fix Release-Asserts.
llvm-svn: 93353
2010-01-13 21:23:04 +00:00
Mike Stump 8521f06ced Fix for Release-Assert.
llvm-svn: 93348
2010-01-13 20:58:35 +00:00
Mike Stump 2f7b246a47 Fix for Release-Asserts.
llvm-svn: 93347
2010-01-13 20:57:29 +00:00
Mike Stump 5c1e7259f1 Fix Release-Asserts.
llvm-svn: 93346
2010-01-13 20:43:31 +00:00
Anders Carlsson 20871481d2 Add a BaseSubobject class to uniquely identify a base class subobject. Not yet used.
llvm-svn: 93345
2010-01-13 20:11:15 +00:00
John McCall e8595036c4 Add type source information for both kinds of typeof types.
Patch by Enea Zaffanella.

llvm-svn: 93344
2010-01-13 20:03:27 +00:00
Ted Kremenek e14e372b67 Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations.
llvm-svn: 93343
2010-01-13 19:59:20 +00:00
Mike Stump 92d487712e Fix for Release-Asserts.
llvm-svn: 93340
2010-01-13 19:40:37 +00:00
Fariborz Jahanian 3f7b8b274d Predefine __weak attribute when doing objective-c
rewriting for any target. (refixes radar 7530235).

llvm-svn: 93331
2010-01-13 18:51:17 +00:00
Ted Kremenek 95ae5e16b9 Add extra null check in clang_disposeString().
llvm-svn: 93328
2010-01-13 18:45:36 +00:00
Douglas Gregor 9de54ea41b Reimplement constructor declarator parsing to cope with template-ids
that name constructors, the endless joys of out-of-line constructor
definitions, and various other corner cases that the previous hack
never imagined. Fixes PR5688 and tightens up semantic analysis for
constructor names.

Additionally, fixed a problem where we wouldn't properly enter the
declarator scope of a parenthesized declarator. We were entering the
scope, then leaving it when we saw the ")"; now, we re-enter the
declarator scope before parsing the parameter list.

Note that we are forced to perform some tentative parsing within a
class (call it C) to tell the difference between

  C(int); // constructor

and

  C (f)(int); // member function

which is rather unfortunate. And, although it isn't necessary for
correctness, we use the same tentative-parsing mechanism for
out-of-line constructors to improve diagnostics in icky cases like:

  C::C C::f(int); // error: C::C refers to the constructor name, but
                  // we complain nicely and recover by treating it as
                  // a type.

llvm-svn: 93322
2010-01-13 17:31:36 +00:00
Douglas Gregor b89b99f1f2 Fix pasto in __has_feature(cxx_lambdas) docs
llvm-svn: 93320
2010-01-13 16:27:49 +00:00
John McCall 6a61b5203d Record some basic information about bad conversion sequences. Use that
information to feed diagnostics instead of regenerating it.  Much room for
improvement here, but fixes some unfortunate problems reporting on method calls.

llvm-svn: 93316
2010-01-13 09:16:55 +00:00
Alexis Hunt c88db06565 Implement semantic checking for C++ literal operators.
This now rejects literal operators that don't meet the requirements.
Templates are not yet checked for.

llvm-svn: 93315
2010-01-13 09:01:02 +00:00
Alexis Hunt 10e2f7264e Update test function names so as not to use potential keywords.
llvm-svn: 93314
2010-01-13 08:58:42 +00:00
Alexis Hunt af4e28d897 Add a bunch more feature-checking macros for C++0x features. Some of these are
disabled with the intent that users can start with them now and not have to change
a thing to have them work when we implement the features.

llvm-svn: 93312
2010-01-13 08:31:49 +00:00
John McCall 6d11e07b16 Insert clang-flags into the clang command. Currently it needs to be a list;
future work should permit strings (by splitting them into a list o' strings).

llvm-svn: 93299
2010-01-13 06:44:51 +00:00
Chris Lattner 3d756f1a9e diagnose invalid values of -ftabstop, patch by Christian Adaker!
llvm-svn: 93288
2010-01-13 03:06:50 +00:00
Mike Stump 1bacb81d6f Add an unreachable code checker.
llvm-svn: 93287
2010-01-13 02:59:54 +00:00
Daniel Dunbar 4f2bc55d4e cc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
clang -cc1 logic for running an action against a set of options.
 - This should make it easier to build tools that have a clang -cc1 like
   interface, but aren't actually part of clang -cc1.

llvm-svn: 93282
2010-01-13 00:48:06 +00:00
Daniel Dunbar 7d38d4da61 cc1: Lift creation of the FrontendAction higher.
llvm-svn: 93281
2010-01-13 00:47:51 +00:00
John McCall e1ac8d1742 Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable.  There's a lot we can do to improve this, but
it's a good start.  Further improvements should probably be integrated with the
bad-initialization reporting routines.

llvm-svn: 93277
2010-01-13 00:25:19 +00:00
Ted Kremenek 78668fdcfb Move definitions for visitor methods in CDeclVisitor out-of-line.
llvm-svn: 93276
2010-01-13 00:22:49 +00:00
Ted Kremenek 1351b09b04 Make method definitions in TUVisitor out-of-line, making it easy to tell what visitor methods are defined.
Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor.

llvm-svn: 93275
2010-01-13 00:13:47 +00:00
Douglas Gregor 08dc584c3f Remove broken fix-it when a default function argument has been
redefined. There's a FIXME with an apology about why we don't try to
do better here. Fixes <rdar://problem/7513023>.

llvm-svn: 93274
2010-01-13 00:12:48 +00:00
Fariborz Jahanian 6fada5be91 When in objective-c methods, do the built-in name lookup after
ivar name lookup. Fixes pr5986.

llvm-svn: 93271
2010-01-12 23:58:59 +00:00
Ted Kremenek 58a6a8ec62 Add USR printing modes to c-index-test.
llvm-svn: 93269
2010-01-12 23:34:26 +00:00
Ted Kremenek a188cbbf29 Make clang_getDeclUSR() visible.
llvm-svn: 93268
2010-01-12 23:34:05 +00:00
Ted Kremenek cb674f9492 Rename clang_getUSR() -> clang_getDeclUSR(). For now we take a CXDecl instead of a CXEntity.
Enhance USR generation a bit with support for records.

llvm-svn: 93267
2010-01-12 23:33:42 +00:00
Douglas Gregor 49862b8285 Don't emit string-comparison or self-comparison warnings in
unevaluated contexts, because they only matter for code that will
actually be evaluated at runtime.

As part of this, I had to extend PartialDiagnostic to support fix-it
hints.

llvm-svn: 93266
2010-01-12 23:18:54 +00:00
Mike Stump 4b0e352061 Remove unused code.
llvm-svn: 93262
2010-01-12 22:20:00 +00:00
Chris Lattner 0c523e513a testcase for -ftabstop, patch by Christian Adaker!
llvm-svn: 93260
2010-01-12 22:06:58 +00:00
Chris Lattner 7011795ee4 use DiagRuntimeBehavior to silence the div/rem by zero warning when
not in an evaluated context.  This removes some bogus warnings.

llvm-svn: 93258
2010-01-12 21:30:55 +00:00
Douglas Gregor 18473f329d Improve recovery for template-ids whose template-name doesn't actually
name a template, when they occur in a base-specifier. This is one of
the (few) places where we know for sure that an identifier followed by
a '<' must be a template name, so we can diagnose and recover well:

test/SemaTemplate/dependent-base-classes.cpp:9:16: error: missing
'template'
      keyword prior to dependent template name 'T::apply'
struct X1 : T::apply<U> { }; // expected-error{{missing 'template' ...
               ^
               template 
test/SemaTemplate/dependent-base-classes.cpp:12:13: error: unknown
template name
      'vector'
struct X2 : vector<T> { }; // expected-error{{unknown template name
'vector'}}
            ^
2 diagnostics generated.

llvm-svn: 93257
2010-01-12 21:28:44 +00:00
Chris Lattner faa5417264 implement PR6004, warning about divide and remainder by zero.
llvm-svn: 93256
2010-01-12 21:23:57 +00:00
Chris Lattner 20aee9b914 implement PR6007, diagnosing invalid attribute((section))
llvm-svn: 93255
2010-01-12 20:58:53 +00:00
Mike Stump a77e48c322 Improve covariance tester to randomize the return value more.
llvm-svn: 93254
2010-01-12 20:55:39 +00:00
Chandler Carruth 04bdce6407 Fix the CodeGen half of PR5911 by changing reference initialization to
correctly look through arrays to see cv-qualifiers. Also enhances the routine
for doing this to preserve more type sugaring for diagnostics.

llvm-svn: 93252
2010-01-12 20:32:25 +00:00
Ted Kremenek 55e3e83b07 Further tweaking of USR generation. WIP.
llvm-svn: 93250
2010-01-12 19:35:53 +00:00
Ted Kremenek 73eccd2c10 Make 'CXTranslationUnitIterator' an argument to perform_test_load(),
perform_test_load_tu(), and perform_test_load_source().

llvm-svn: 93248
2010-01-12 18:53:15 +00:00
Fariborz Jahanian 42c06998ea Define __weak attribute for objective-c pointers in
win32 targets. Fixes radar 7530235. Daniel please review.

llvm-svn: 93246
2010-01-12 18:33:57 +00:00
Douglas Gregor 46c59614d3 Parse dependent template-ids in base clauses and member
initializers. This isn't actually in the C++ grammar (in any version),
but that's clearly an oversight: both GCC and EDG support this syntax,
and it's used within Boost code. I'll file a core issue proposing
precisely the change made here. Fixes PR6008.

llvm-svn: 93243
2010-01-12 17:52:59 +00:00
Fariborz Jahanian 12e2e86f0f Improve on objective-c pointer recognition
during rewrite. No functionality chang.

llvm-svn: 93241
2010-01-12 17:31:23 +00:00