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

121 Коммитов

Автор SHA1 Сообщение Дата
John McCall 6dbba4fc12 Catch placeholder types in DefaultLvalueConversion
and DefaultFunctionArrayLvalueConversion.  To prevent
significant regression for should-this-be-a-call fixits,
and to repair some such regression from the introduction of
bound member placeholders, make those placeholder checks
try to build calls appropriately.  Harden the build-a-call
logic while we're at it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141738 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 23:14:30 +00:00
Richard Smith 856ebfb635 Remove FIXME obsoleted by change r141279 for PR11067.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 03:16:33 +00:00
John McCall d1e40d5389 Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140957 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-02 01:16:38 +00:00
Richard Smith 947be1941e Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140820 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 23:18:34 +00:00
Richard Smith c6d990a767 constexpr: semantic checking for constexpr variables.
We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140801 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 19:11:37 +00:00
Richard Smith 2315318436 PR10867: Work around a bug in lit. Multiple RUN: lines are joined with &&, so:
RUN: foo
  RUN: bar || true

is equivalent to:

  RUN: foo && bar || true

which is equivalent to:

  RUN: (foo && bar) || true

This resulted in several of the fixit tests not really testing anything.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139132 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 03:01:15 +00:00
Kaelyn Uhrain f0c1d8f804 Improve overloaded function handling in the typo correction code.
Change TypoCorrection to store a set of NamedDecls instead of a single
NamedDecl. Also add initial support for performing function overload
resolution to Sema::DiagnoseEmptyLookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 20:36:05 +00:00
Douglas Gregor f78c4e5712 Introduce a Fix-It for the "missing sentinel" warning, adding an
appropriate sentinel at the end of the argument list. Also, put the
sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136566 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 08:57:03 +00:00
Anna Zaks d5612a235f Add a fixit for removal of unused label.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136389 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 20:52:06 +00:00
Anna Zaks 1d05d424cb Another test case for the &/* mismatch fixit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 19:55:52 +00:00
Anna Zaks 6722155dfe Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 19:51:27 +00:00
Fariborz Jahanian 8eaefdc6ae Provide fixit for static use of objective-c type
in few more places and in each instance, fix up
the type to the expected type. // rdar://9603056


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 17:58:54 +00:00
Fariborz Jahanian dcf1011876 objective-c: Provide a 'fixit' when class was used
to declare a static object. // rdar://9603056


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 21:12:27 +00:00
Fariborz Jahanian feb4fa165c Add FixIt hint for missing 'id' type.
// rdar://9615045


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135685 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-21 17:38:14 +00:00
Anna Zaks ffe9edd45f Addressing code review comments for commit 135509 - Add FixItHints in case a C++ function call is missing * or & operators on
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135643 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-21 00:34:39 +00:00
Anna Zaks b89fe6b04c Add FixItHints in case a C++ function call is missing * or & operators on one/several of it's parameters (addresses http://llvm.org/PR5941).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 19:49:12 +00:00
Douglas Gregor 3a348c86ff Add a hackaround to avoid the crash in PR10355. However, our recovery
is still terrible here because typo correction is not behaving well in
the presence of overloaded functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 04:54:23 +00:00
Douglas Gregor 07f4a06c40 When adding boolean keywords for typo correction, add either "bool" or
"_Bool" (depending on dialect), but not both, since they have the same
edit distance from "Bool".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134263 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 21:27:45 +00:00
Douglas Gregor d8bba9c152 Add support for C++ namespace-aware typo correction, e.g., correcting
vector<int>

to

  std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 16:20:02 +00:00
Fariborz Jahanian 6326e05fe8 Provide fix-it for '.' <-> '->' for Objective-C ivar/property access.
// rdar://7811841


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 00:00:52 +00:00
Argyrios Kyrtzidis b5303aa20e Allow the fixit for missing ':' in the ?: ternary operator if it is pointing
at the start of a macro instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133801 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 17:28:29 +00:00
Chad Rosier 02a444dc80 Fixed test case asserts due to checkin of r130710.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130720 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02 20:39:21 +00:00
Douglas Gregor 3b887354b1 Extend Sema::ClassifyName() to support C++, ironing out a few issues
in the classification of template names and using declarations. We now
properly typo-correct the leading identifiers in statements to types,
templates, values, etc. As an added bonus, this reduces the number of
lookups required for disambiguation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 04:48:22 +00:00
Douglas Gregor 6add6fbc59 Fix test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130285 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 04:02:56 +00:00
Douglas Gregor 27766d2501 Improve diagnostics for typo correction via Sema::ClassifyName(), by
looking at the context and the correction and using a custom
diagnostic. Also, enable some Fix-It tests that were somewhat lamely
disabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130283 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 03:47:06 +00:00
Douglas Gregor 312eadb832 Implement a new identifier-classification scheme where Sema
performs name lookup for an identifier and resolves it to a
type/expression/template/etc. in the same step. This scheme is
intended to improve both performance (by reducing the number of
redundant name lookups for a given identifier token) and error
recovery (by giving Sema a chance to correct type names before the
parser has decided that the identifier isn't a type name). For
example, this allows us to properly typo-correct type names at the
beginning of a statement:

t.c:6:3: error: use of undeclared identifier 'integer'; did you mean
'Integer'?
  integer *i = 0;
  ^~~~~~~
  Integer
t.c:1:13: note: 'Integer' declared here
typedef int Integer;
            ^


Previously, we wouldn't give a Fix-It because the typo correction
occurred after the parser had checked whether "integer" was a type
name (via Sema::getTypeName(), which isn't allowed to typo-correct)
and therefore decided to parse "integer * i = 0" as an expression. By
typo-correcting earlier, we typo-correct to the type name Integer and
parse this as a declaration. 

Moreover, in this context, we can also typo-correct identifiers to
keywords, e.g.,

t.c:7:3: error: use of undeclared identifier 'vid'; did you mean
'void'?
  vid *p = i;
  ^~~
  void

and recover appropriately.

Note that this is very much a work-in-progress. The new
Sema::ClassifyName is only used for expression-or-declaration
disambiguation in C at the statement level. The next steps will be to
make this work for the same disambiguation in C++ (where
functional-style casts make some trouble), then push it
further into the parser to eliminate more redundant name lookups.

Fixes <rdar://problem/7963833> for C and starts us down the path of
<rdar://problem/8172000>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130082 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-24 05:37:28 +00:00
Argyrios Kyrtzidis b8a9d3b801 Fixit suggestion for adding missing tag name should have a space after the tag name. Fixes rdar://9295072
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 17:29:47 +00:00
Richard Smith 162e1c1b48 Support for C++11 (non-template) alias declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129567 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 14:24:37 +00:00
Fariborz Jahanian 6027461b6c Issue the 2nd fixit even if fix-it hint is supressed.
// rdar://9091893


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129481 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 22:18:37 +00:00
Fariborz Jahanian 81ab3cfcf2 No fixit hint for builtin expressions which are
defined in a macro. // rdar://9091893


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129465 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 20:31:26 +00:00
Francois Pichet 4147d30708 Improve recovery (error + fix-it) when parsing type dependent template name without the "template" keyword.
For example:
   typename C1<T>:: /*template*/ Iterator<0> pos; 

Also the error is downgraded to an ExtWarn in Microsoft mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128387 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 19:41:34 +00:00
Fariborz Jahanian 12e3ecec90 Provide Fixit warning when 'auto' is intended as storage
specifier in legacy code. Patch is reviewed offline by Doug.
// rdar://9036633.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126261 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 23:17:49 +00:00
Douglas Gregor 5f39f706af Remove the Fix-It for "main must return 'int'", which is not always
correct and is not worth fixing. Fixes PR8396.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 19:04:23 +00:00
Douglas Gregor c37b736150 Disable this test until we figure out what madness it causes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 23:34:31 +00:00
Douglas Gregor 9c13f5bc0e Sign
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117400 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 21:25:18 +00:00
Douglas Gregor 30af47fde1 I hate this test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 19:36:20 +00:00
Douglas Gregor 808bedfd8c Something is seriously wonky with this test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 18:25:19 +00:00
Douglas Gregor bddf8ebd79 Fix silly typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117373 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 17:32:59 +00:00
Douglas Gregor 53e4b55d2c Teach typo correction not to return the same keyword that matches a
typo. This can happen with context-sensitive keywords like "super",
when typo correction didn't know that "super" wasn't permitted in this
context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 17:18:00 +00:00
Anders Carlsson b164a19eb4 Minor tweak so that fixit-errors.c is never compiled; it crashes and pops up a crash dialog on my system.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 23:35:40 +00:00
Douglas Gregor 9a632eaa0e Fix handling of property and ivar lookup in typo correction; the two
kinds of lookup into Objective-C classes were tangled together, a
situation that was compounded by automatically synthesized ivars.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 03:06:34 +00:00
Douglas Gregor 06ff47b0bb Disable this test while I track down the platform-specific issue
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 01:46:04 +00:00
Douglas Gregor b4226ff0e4 Bah, incompetence
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116898 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 01:16:12 +00:00
Douglas Gregor f98402d9e6 Eliminate another ordering dependency in typo correction. Re-enable typo.m, which seems to be working properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 01:01:57 +00:00
Douglas Gregor 31df9be7a8 Disable this test again, which naturally fails on every platform except the one I'm building with
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116642 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 23:23:05 +00:00
Douglas Gregor 6eaac8b3e6 When performing typo correction, keep track of whether the last lookup
we did was an acceptable lookup. If it is, then we can re-use that
lookup result. If it isn't, we have to perform the lookup again. This
is almost surely the cause behind the mysterious typo.m failures on
some builders; we were getting the wrong lookup results returned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 16:49:56 +00:00
Daniel Dunbar 8712930d4f Disable type.m while failures are investigated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 15:28:09 +00:00
Daniel Dunbar b63ff72252 Make test more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116576 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 15:13:02 +00:00
Argyrios Kyrtzidis a6eb5f81d1 When we encounter a '==' in a context expecting a '=', assume the user made a typo:
t.c:1:7: error: invalid '==' at end of declaration; did you mean '='?
int x == 0;
      ^~
      =

Implements rdar://8488464.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116035 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08 02:39:23 +00:00
Francois Pichet c71d8eb659 Better diagnostic for superfluous scope specifier inside a class definition for member functions. + Fixit.
Example: 
class A {
   void A::foo(); //warning: extra qualification on member 'foo'
};


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115347 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 21:19:28 +00:00