Commit Graph

284 Commits

Author SHA1 Message Date
Alexander Potapenko e2e8b0e009 Revert r218925 - "Patch to warn if 'override' is missing"
This CL has caused bootstrap failures on Linux and OSX buildbots running with -Werror.

Example report from http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/13183/steps/bootstrap%20clang/logs/stdio:

================================================================
[ 91%] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/AMDGPUISelDAGToDAG.cpp:20:
In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIISelLowering.h:19:
/home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIInstrInfo.h:71:8: error: 'getLdStBaseRegImmOfs' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  bool getLdStBaseRegImmOfs(MachineInstr *LdSt,
       ^
/home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/include/llvm/Target/TargetInstrInfo.h:815:16: note: overridden virtual function is here
  virtual bool getLdStBaseRegImmOfs(MachineInstr *LdSt,
               ^
================================================================

llvm-svn: 218969
2014-10-03 09:02:53 +00:00
Fariborz Jahanian b91c5d6a79 Patch to warn if 'override' is missing
for an overriding method if class has at least one
'override' specified on one of its methods.
Reviewed by Doug Gregor. rdar://18295240
(I have already checked in all llvm files with missing 'override'
 methods and Bob Wilson has fixed a TableGen of FastISel so
 no warnings are expected from build of llvm after this patch.
 I have already verified this). 

llvm-svn: 218925
2014-10-02 23:13:51 +00:00
Ismail Pazarbasi 129c44c753 Suggest fix-it for missing '{' after base-clause
llvm-svn: 218468
2014-09-25 21:13:02 +00:00
Richard Smith efa6f736e6 Add error, recovery and fixit for "~A::A() {...}".
llvm-svn: 217302
2014-09-06 02:06:12 +00:00
Fariborz Jahanian 19c2e2fab2 Objective-C [qoi]. Provide fix-it hint when sending
class method to an object receiver. rdar://16263395

llvm-svn: 216038
2014-08-19 23:39:17 +00:00
Aaron Ballman dd69ef38db C++1y is now C++14!
Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording.

llvm-svn: 215982
2014-08-19 15:55:55 +00:00
Fariborz Jahanian 5ab8750c5c Objective-C [qoi]. Patch to not do Fix-It for fixing
a messaging expression except in the simple case
of a unary selector. We cannot reliably provide such a fixit due
to numerous reasons where a matching selector could not be found.
rdar://15756038

llvm-svn: 215480
2014-08-12 22:16:41 +00:00
Fariborz Jahanian 0b1d28866c Objective-C [qoi]. Issue warning and fixit if property-dot syntax
use mis-cased property name (which is currently accepted silently
due to the way property setters are named). rdar://17911746

llvm-svn: 215250
2014-08-08 22:33:24 +00:00
Alp Toker 0621cb2e7d Make clang's rewrite engine a core feature
The rewrite facility's footprint is small so it's not worth going to these
lengths to support disabling at configure time, particularly since key compiler
features now depend on it.

Meanwhile the Objective-C rewriters have been moved under the
ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still
potentially worth excluding from lightweight builds.

Tests are now passing with any combination of feature flags. The flags
historically haven't been tested by LLVM's build servers so caveat emptor.

llvm-svn: 213171
2014-07-16 16:48:33 +00:00
Fariborz Jahanian 53f867ac45 Objective-C ARC. Provide diagnostic and fix-it
when casting a retainable object to a objc_bridge_related
CF type with the suggestion of applying the method
specified in the bridging attribute to the object.
// rdar://15932435

llvm-svn: 211807
2014-06-26 21:22:16 +00:00
Fariborz Jahanian dacffc0d8d Objective-C. When we use @selector(save:), etc. there may be more
than one method with mismatched type of same selector name. 
clang issues a warning to point this out since it may cause 
undefined behavior. There are cases though that some APIs 
don't care about user methods and such warnings are perceived as 
noise. This patch allows users to add paren delimiters around
selector name to turn off such warnings. So, @selector((save:)) will
turn off the warning. It also provides 'fixit' so user knows 
what to do. // rdar://16458579

llvm-svn: 211611
2014-06-24 17:02:19 +00:00
Richard Smith 78e1ca692b [C++1z] Implement N4051: 'typename' is permitted instead of 'class' when declaring a template template parameter.
llvm-svn: 211031
2014-06-16 15:51:22 +00:00
Nikola Smiljanic 69fdc9ff89 PR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant ellipsis in parameter pack.
llvm-svn: 210304
2014-06-06 02:58:59 +00:00
Benjamin Kramer 5b81765bfd Fix test on platforms where size_t is not 'unsigned long'.
llvm-svn: 209974
2014-05-31 15:06:33 +00:00
Jordan Rose bc53ed1ee6 Format strings: check against an enum's underlying type.
This allows us to be more careful when dealing with enums whose fixed
underlying type requires special handling in a format string, like
NSInteger.

A refinement of r163266 from a year and a half ago, which added the
special handling for NSInteger and friends in the first place.

<rdar://problem/16616623>

llvm-svn: 209966
2014-05-31 04:12:14 +00:00
Richard Smith 4b55a9c841 Refactor all the checking for missing 'template<>'s when a declaration has a
template-id after its scope specifier into a single place.

llvm-svn: 206442
2014-04-17 03:29:33 +00:00
Richard Smith 82dce550c8 PR19415: Converting 'constexpr' to 'const' in a non-static data member can fail
if the member is already 'const'. Don't assert in that case.

llvm-svn: 206205
2014-04-14 21:00:40 +00:00
David Majnemer b100410365 Normalize line endings
Some files had CRLF line terminators, some only had a mixture of
CRLF and LF.  Switch to LF.

llvm-svn: 202659
2014-03-02 18:46:05 +00:00
NAKAMURA Takumi 0c81c716eb check-clang: Introduce the feature "utf8-capable-terminal".
clang/test/FixIt/fixit-unicode-with-utf8-output.c has begun complained since LLVM r200885.
Although it is changes for StringRef, it brought LLVM_ON_WIN32 to Support/Locale.cpp.

Before r200885, LLVM_ON_WIN32 was undefined in Locale.cpp!

FIXME: We should consider i18n on win32.
llvm-svn: 200909
2014-02-06 07:15:59 +00:00
Kaelyn Uhrain 59baee8451 Apply the typo correction replacement location fix from r191450 to the
case when correcting for too many arguments (r191450 had only fixed the
problem for when there were too few arguments). Also fix the underlining
for both cases.

llvm-svn: 200268
2014-01-28 00:46:47 +00:00
Fariborz Jahanian 283bf89506 Objective-C. After providing a fix-it for a
cstring, converted to NSString, produce the
matching AST for it. This also required some
refactoring of the previous code. // rdar://14106083

llvm-svn: 197605
2013-12-18 21:04:43 +00:00
Fariborz Jahanian bd714e9bb1 Objective-C. Make diagnostics and fix-its consistent
when diagnosing casting of a cstring literal to
NSString in default and -fobjc-arc mode. 
// rdar://14106083

llvm-svn: 197515
2013-12-17 19:33:43 +00:00
Dmitri Gribenko 3fb18bbd34 Add a test for -fno-diagnostics-fixit-info
llvm-svn: 197450
2013-12-17 01:19:19 +00:00
Fariborz Jahanian 88b6898085 ObjectiveC. Provide a property-dot syntax for fixit
when selector in objc_bridge_related attribute names
a property. // rdar://15517899

llvm-svn: 196984
2013-12-10 23:18:06 +00:00
Fariborz Jahanian db76577f43 Objective-C. Provide fixit's for objc_bride_related
attributed CF to ObjC type conversions.
// rdar://15499111

llvm-svn: 196935
2013-12-10 17:08:13 +00:00
Alp Toker 6d023c4f1e Fix test to actually check the FixIt-applied code
r102230 added an 'echo' making this a no-op.

Also fixes FAIL on native Windows with no shell/GnuWin32.

llvm-svn: 193938
2013-11-03 01:50:38 +00:00
Ted Kremenek da2f405b09 Special case '%C' handling in ObjC format strings to handle integer literals that can represent unicode characters
Fixes <rdar://problem/13991617>.

llvm-svn: 192673
2013-10-15 05:25:17 +00:00
Kaelyn Uhrain deedc3a6bd Fix a bug in the typo correction replacement location.
I noticed the wrong text was being replaced with the correction while
working on expanding the "namespace-aware" typo correction to include
classes.

llvm-svn: 191450
2013-09-26 19:10:34 +00:00
Kaelyn Uhrain 95995be7a3 Teach typo correction to look inside of classes like it does namespaces.
Unlike with namespaces, searching inside of classes requires also
checking the access to correction candidates (i.e. don't suggest a
correction to a private class member for a correction occurring outside
that class and its methods or friends).

Included is a small (one line) fix for a bug, that was uncovered while
cleaning up the unit tests, where the decls from a TypoCorrection candidate
were preserved in new TypoCorrection candidates that are derived (copied)
from the old TypoCorrection--notably when creating a new candidate by
changing the NestedNameSpecifier associated with the base idenitifer.

llvm-svn: 191449
2013-09-26 19:10:29 +00:00
Richard Smith b8c65f0136 Testcase I forgot to svn add in r191057.
llvm-svn: 191067
2013-09-20 02:48:08 +00:00
Benjamin Kramer 6ee1562cfc Unify handling of string literal arguments for attributes and add fixits.
This fixes a couple of latent crashes for invalid attributes and also adds a
fixit hint to turn identifiers into string literals if one was expected. It then
proceeds recovery as if the identifier was a literal. Diagnostic locations are
also changed to point at the literal instead of the attribute if the error
concerns the argument. PR17175.

For example:
hidden.c:1:40: error: 'visibility' attribute requires a string
extern int x __attribute__((visibility(hidden)));
                                       ^
                                       "     "
hidden.c:2:29: error: visibility does not match previous declaration
extern int x __attribute__((visibility("default")));
                            ^
hidden.c:1:29: note: previous attribute is here
extern int x __attribute__((visibility(hidden)));
                            ^

llvm-svn: 190699
2013-09-13 15:35:43 +00:00
NAKAMURA Takumi 4c57b9db10 clang/test/FixIt/fixit-unicode-with-utf8-output.c: Remove XFAIL.
It'd be another issue that the terminal and stdout(including redirects) with utf8. This test XPASSed on Win32, at least on Lit.

FYI, we don't use a triplet like "-win64" anywhere.

llvm-svn: 190559
2013-09-11 23:09:22 +00:00
Alexander Kornienko 48c9900713 Test for correct usage of columnWidth in clang fixit hints.
Summary:
This test only works on systems capable of outputting UTF-8 encoded
text on the standard output (tested on linux and OS X, should XFAIL on windows,
if I haven't messed up the XFAIL line).

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1607

llvm-svn: 190537
2013-09-11 18:10:30 +00:00
Roman Divacky 718fb1cdf9 Make the information about disabled ARCMT/Rewriter/StaticAnalyzer available
to lit and use this info to disable Analysis/FixIt/Rewriter/Analysis tests
when those are not compiled into clang.

llvm-svn: 189395
2013-08-27 19:27:35 +00:00
Richard Smith 114394f824 Implement [class.friend]p11's special name lookup rules for friend declarations
of local classes. We were previously handling this by performing qualified
lookup within a function declaration(!!); replace it with the proper scope
lookup.

llvm-svn: 188050
2013-08-09 04:35:01 +00:00
Kaelyn Uhrain 957c8b1c70 A few small cleanups to r187504. Thanks to dblaikie for the assist.
llvm-svn: 187521
2013-07-31 20:16:17 +00:00
Kaelyn Uhrain bad7fb09b2 Move the "->" to "." fixit from r186128 into a separate note since
recovery is not attempted with the fixit. Also move the associated test
case from FixIt/fixit.cpp to SemaCXX/member-expr.cpp since the fixit is
no longer automatically applied.

llvm-svn: 186342
2013-07-15 19:54:54 +00:00
Kaelyn Uhrain 638264ea2a Provide a better diagnostic and a fixit for a '.' or '->' before the left paren
of a function call.

This fixes PR5898 and means we now have a better diagnostic here than GCC.

llvm-svn: 186208
2013-07-12 21:43:02 +00:00
Kaelyn Uhrain 1bb5dbf628 Provide a fixit hint for changing '->' to '.' if there is no operator->
defined for a class.

llvm-svn: 186128
2013-07-11 22:38:30 +00:00
Richard Smith 9ce302ed9c PR5066: If a declarator cannot have an identifier, and cannot possibly be
followed by an identifier, then diagnose an identifier as being a bogus part of
the declarator instead of tripping over it. Improves diagnostics for cases like

  std::vector<const int *p> my_vec;

llvm-svn: 186061
2013-07-11 05:10:21 +00:00
Kaelyn Uhrain 8ec9f5f60e Offer typo suggestions for 'using' declarations.
Patch courtesy of Luke Zarko <zarko@google.com>

llvm-svn: 186019
2013-07-10 17:34:22 +00:00
Kaelyn Uhrain 476c823ec8 Attempt typo correction for function calls with the wrong number of arguments.
Combined with typo correction's new ability to apply global/absolute nested
name specifiers to possible corrections, cases such as in PR12287 where the
desired function is being shadowed by a lexically closer function with the
same name but a different number of parameters will now include a FixIt.

On a side note, since the test for this change caused
test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for
a single file, I've included a test case for exceeding the limit and added
some comments to both the original and part two of typo-correction.cpp
warning future editors of the files about the limit.

llvm-svn: 185881
2013-07-08 23:13:44 +00:00
Rafael Espindola 925213b0fa Add 'not' to commands that are expected to fail.
This is at least good documentation, but also opens the possibility of
using pipefail.

llvm-svn: 185652
2013-07-04 16:16:58 +00:00
Kaelyn Uhrain 10413a46a0 Allow typo correction to try removing nested name specifiers.
The removal is tried by retrying the failed lookup of a correction
candidate with either the MemberContext or SS (CXXScopeSpecifier) or
both set to NULL if they weren't already. If the candidate identifier
is then looked up successfully, make a note in the candidate that the
SourceRange should include any existing nested name specifier even if
the candidate isn't adding a different one (i.e. the candidate has a
NULL NestedNameSpecifier).

Also tweak the diagnostic messages to differentiate between a suggestion
that just replaces the identifer but leaves the existing nested name
specifier intact and one that replaces the entire qualified identifier,
in cases where the suggested replacement is unqualified.

llvm-svn: 185487
2013-07-02 23:47:44 +00:00
Kaelyn Uhrain b18b0c0f16 Look for corrections in enclosing namespaces that require a global NestedNameSpecifier.
CorrectTypo will now see and consider those corrections that are effectively
shadowed by other declarations in a closer context when resolved via an
unqualified lookup. This involves adding any parent namespaces to the set of
namespaces as fully-qualified name specifiers, and also adding potential
corrections that passed name lookup but were rejected by the given
CorrectionCandidateCallback into the set of failed corrections that should be
tried with the set of namespace specifiers.

llvm-svn: 185486
2013-07-02 23:47:35 +00:00
Kaelyn Uhrain 52dd02d8ef Add the global namespace (the "::" namespace specifier) to the list of
namespaces to try for potential typo corrections.

llvm-svn: 184762
2013-06-24 17:49:03 +00:00
Fariborz Jahanian 4cc5552b9b Objective-C [qoi]: privide typo correction for selectors
in addition of receiver having static type, but also when
receiver has dynamic type (of 'id' variety) as well as when
receiver is of 'Class' type vareity. // rdar://7853549

llvm-svn: 184195
2013-06-18 15:31:36 +00:00
Fariborz Jahanian 7548167845 Objective-C [qoi]: Provide fixit hint when message with typo
is sent to a receiver object. This is wip. // rdar://7853549

llvm-svn: 184086
2013-06-17 17:10:54 +00:00
Eli Friedman 31a5bcc24e Unify return type checking for functions and ObjC methods. Move all the
random checks for ObjC object return types to SemaType.cpp.

Fixes issue with ObjC method type checking reported on cfe-dev.

llvm-svn: 184006
2013-06-14 21:14:10 +00:00
Richard Smith 8ca78a16f4 Add -Wdeprecated warnings and fixits for things deprecated in C++11:
- 'register' storage class
 - dynamic exception specifications

Only the former check is enabled by default for now (the latter might be quite noisy).

llvm-svn: 183881
2013-06-13 02:02:51 +00:00