Commit Graph

1530 Commits

Author SHA1 Message Date
Ted Kremenek eb0a6c0a85 Fix test regression introduced by r145656. When seeing a string literal that isn't accepted by 'asm', skip to the enclosing ')'.
llvm-svn: 145662
2011-12-02 01:30:14 +00:00
Ted Kremenek 65cdbf58a7 Diagnose use of wide string literal in 'asm' instead of crashing. Fixes <rdar://problem/10465079>.
llvm-svn: 145656
2011-12-02 00:35:46 +00:00
Richard Smith b3041feaf7 Revert most of r145372 for now. Lookahead beyond the ';' in a function
declaration tickles a bug in the way we handle visibility pragmas.

The improvement to error recovery for template function definitions declared
with the 'typedef' specifier in r145372 is unrelated and not reverted here.

llvm-svn: 145541
2011-11-30 23:45:35 +00:00
Douglas Gregor 71944203de Switch the module-loading interfaces and parser from a simple
top-level module name to a module path (e.g., std.vector). We're still
missing a number of pieces for this actually to do something.

llvm-svn: 145462
2011-11-30 00:36:36 +00:00
Richard Smith 53711607a0 Add fix-it to remove 'typedef' from function template definitions. Such a token
was probably meant to be 'typename', which we will have already suggested if it
is appropriate.

llvm-svn: 145395
2011-11-29 09:09:06 +00:00
Argyrios Kyrtzidis 004685bdf7 Fix leaking of LexedMethod objects created for caching objc method definitions tokens
for late parsing.

llvm-svn: 145394
2011-11-29 08:14:54 +00:00
Richard Smith 675ea99a2a PR10101: Recover better from a common copy-paste error: if a function
declaration at namespace scope is followed by a semicolon and an open-brace
(or in C++, a 'try', ':' or '='), then the error is probably a function
definition with a spurious ';', rather than a mysterious '{'.

llvm-svn: 145372
2011-11-29 05:27:40 +00:00
Francois Pichet 6dc4c16417 Enable delayed template parsing for friend functions declared at template class scope.
llvm-svn: 144980
2011-11-18 23:47:17 +00:00
Argyrios Kyrtzidis 841dd8861a Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

llvm-svn: 144943
2011-11-18 00:26:59 +00:00
Argyrios Kyrtzidis 516eec2d8b [libclang] Fix crash on invalid code. Fixes rdar://10451854
llvm-svn: 144766
2011-11-16 02:35:10 +00:00
Richard Smith 1c7047375a PR11148: Fix crash-on-invalid if an invalid member declaration is marked as
defaulted or deleted.

llvm-svn: 144270
2011-11-10 09:08:44 +00:00
Douglas Gregor 5d1b4e3d1f When we notice that a member function is defined with "= delete" or "=
default", make a note of which is used when creating the
initial declaration. Previously, we would wait until later to handle
default/delete as a definition, but this is too late: when adding the
declaration, we already treated the declaration as "user-provided"
when in fact it was merely "user-declared".

Fixes PR10861 and PR10442, along with a bunch of FIXMEs.

llvm-svn: 144011
2011-11-07 20:56:01 +00:00
Douglas Gregor df593fbeda Tighten up the conditions under which we consider ourselves to be
entering the context of a nested-name-specifier. Fixes
<rdar://problem/10397846>.

llvm-svn: 143967
2011-11-07 17:33:42 +00:00
David Blaikie 8c045bcf9d Remove duplicate word & unnecessary conditional.
llvm-svn: 143907
2011-11-07 03:30:03 +00:00
Peter Collingbourne 62c219809c Correct the grammar for __builtin_astype.
llvm-svn: 143777
2011-11-05 03:47:48 +00:00
Eli Friedman 055c970839 Add an option to emulate the strange Apple gcc behavior of #pragma pack.
<rdar://problem/10374763>

llvm-svn: 143527
2011-11-02 01:53:16 +00:00
David Blaikie dd58d4ca8f Handle redundant 'typename' on base class specifications.
llvm-svn: 142937
2011-10-25 18:46:41 +00:00
David Blaikie afa155fb88 Fix erroneous name-specifiers prior to decltypes better/correctly as per Doug's feedback.
llvm-svn: 142935
2011-10-25 18:17:58 +00:00
David Blaikie b75951f477 Initialize the BaseLoc for decltype base type specifications.
llvm-svn: 142929
2011-10-25 17:14:10 +00:00
David Blaikie 1cd50022b2 Fix cases where the optional nested-name-specifier erroneously preceeded a decltype-specification when specifying a base type.
llvm-svn: 142928
2011-10-25 17:10:12 +00:00
David Blaikie 00ee7a081d Support the use of decltype for specifying base types. Fixes PR11216.
llvm-svn: 142926
2011-10-25 15:01:20 +00:00
Douglas Gregor 4a2a8f7fb8 Check for unexpanded parameter packs in the name that guards a
Microsoft __if_exists/__if_not_exists statement. Also note that we
weren't traversing DeclarationNameInfo *at all* within the
RecursiveASTVisitor, which would be rather fatal for variadic
templates.

llvm-svn: 142906
2011-10-25 03:44:56 +00:00
Douglas Gregor deb4a2be67 Implement support for dependent Microsoft __if_exists/__if_not_exists
statements. As noted in the documentation for the AST node, the
semantics of __if_exists/__if_not_exists are somewhat different from
the way Visual C++ implements them, because our parsed-template
representation can't accommodate VC++ semantics without serious
contortions. Hopefully this implementation is "good enough".

llvm-svn: 142901
2011-10-25 01:33:02 +00:00
Douglas Gregor 43edb32f1f Rework Microsoft __if_exists/__if_not_exists parsing and semantic
analysis to separate dependent names from non-dependent names. For
dependent names, we'll behave differently from Visual C++:

  - For __if_exists/__if_not_exists at class scope, we'll just warn
    and then ignore them.
  - For __if_exists/__if_not_exists in statements, we'll treat the
    inner statement as a compound statement, which we only instantiate
    in templates where the dependent name (after instantiation)
    exists. This behavior is different from VC++, but it's as close as
    we can get without encroaching ridiculousness.

The latter part (dependent statements) is not yet implemented.

llvm-svn: 142864
2011-10-24 22:31:10 +00:00
Peter Collingbourne ccbcce0219 Simplify parsing ellipsis in Parser::ParseAlignArgument, spotted by Doug.
llvm-svn: 142814
2011-10-24 17:56:00 +00:00
Peter Collingbourne 7d33cd3a2f Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.
llvm-svn: 142760
2011-10-23 20:07:52 +00:00
Douglas Gregor 60060d6f8f Treat the Microsoft/Borland keyword "__except" as a context-sensitive
keyword, because both libstdc++ and libc++ use "__except" as an
identifier. Fixes <rdar://problem/10322555>.

llvm-svn: 142636
2011-10-21 03:57:52 +00:00
Richard Smith f411196d15 'extern template' is a C++11 feature. Add an Extension for C++98 (this matches
gcc's behaviour), and a -Wc++98-compat-pedantic warning for C++11.

llvm-svn: 142597
2011-10-20 18:35:58 +00:00
Richard Smith 09f76ee63c Improve the diagnostic when a comma ends up at the end of a declarator group
instead of a semicolon (as sometimes happens during refactorings). When such a
comma is seen at the end of a line, and is followed by something which can't
possibly be a declarator (or even something which might be a plausible typo for
a declarator), suggest that a semicolon was intended.

llvm-svn: 142544
2011-10-19 21:33:05 +00:00
Douglas Gregor e248eea214 Improve the warning for cv-qualifiers on free functions, from Ahmed Charles!
llvm-svn: 142478
2011-10-19 06:04:55 +00:00
Fariborz Jahanian 7f73302b4f objc: allow class name qualified with protocols in
iboutletcollection attribute. But ignore protocol
list. // rdar://10296078

llvm-svn: 142459
2011-10-18 23:13:50 +00:00
Fariborz Jahanian 6b70865ec0 objc: diagnose invalid argument to an
iboutletcollection attribute intead of crashing.
// rdar://10296078

llvm-svn: 142364
2011-10-18 17:11:10 +00:00
Richard Smith b15c11c819 Add -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
'char32_t', 'constexpr', 'decltype', 'noexcept', 'nullptr' and 'static_assert'.

llvm-svn: 142302
2011-10-17 23:06:20 +00:00
Richard Smith b12bf69769 Refactor __attribute__ parsing, and add a diagnostic if the r_paren at the end
of an attrib is missing. gcc does not allow the closing parenthesis to be omitted.

llvm-svn: 142255
2011-10-17 21:20:17 +00:00
Douglas Gregor 50cefbf212 When we end up having to parse the initializer of a C++ member early
in -fms-extensions mode, make sure we actually use that initializer
after having handled the declaration. Fixes PR11150.

llvm-svn: 142195
2011-10-17 17:09:53 +00:00
Erik Verbruggen fd979b1eaf Fixed merge-mistake where ActOnAccessSpecifier was called twice for every access specifier. The testcase has been changed to catch this too.
llvm-svn: 142186
2011-10-17 09:54:52 +00:00
Richard Smith 5d164bc5e0 Implement -Wc++98-compat warnings for the parser.
llvm-svn: 142056
2011-10-15 05:09:34 +00:00
Richard Smith da2611199b Refactor: remove redundant check for 'final' specifier when parsing class/struct definition.
llvm-svn: 142054
2011-10-15 04:21:46 +00:00
Richard Smith bffe88027c Rename an ExtWarn to ext_ for consistency.
llvm-svn: 142049
2011-10-15 03:55:17 +00:00
Richard Smith 2db9652b5a Don't warn about use of 'final' in ill-formed C++98 code which didn't use
'final', and don't accept (then silently discard) braced init lists in C++98
new-expressions.

llvm-svn: 142048
2011-10-15 03:38:41 +00:00
Anton Korobeynikov f0c267e6e0 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Richard Smith f679b5b6a6 -Wc++98-compat: warn on C++11 attributes and alignas.
llvm-svn: 141999
2011-10-14 20:48:27 +00:00
Richard Smith 96bd62f769 Reinstate r141898 (reverted in r141921), without the -Wc++98-compat-variadic-templates flag. Consensus is that -Wc++98-compat is a useful addition to clang, but per-C++11-feature warnings may not be.
Original patch by Jeffrey Yasskin.

llvm-svn: 141985
2011-10-14 20:31:37 +00:00
Jeffrey Yasskin de8a104633 Revert the -Wc++98-compat flag because dgregor doesn't like it.
llvm-svn: 141921
2011-10-14 00:04:00 +00:00
Jeffrey Yasskin a722170eb9 Implement the first piece of a -Wc++98-compat flag so that people can build in
C++11 mode but keep their sources compatible with C++98.  This patch implements
the -Wc++98-compat-variadic-templates sub-flag and -Wc++98-compat to include
it.

llvm-svn: 141898
2011-10-13 22:18:05 +00:00
Erik Verbruggen ca98f2a63f Allow for annotate attributes after access specifiers. When such
attributes are found, propagate them to subsequent declarations.

llvm-svn: 141861
2011-10-13 09:41:32 +00:00
David Blaikie eba32c2229 Fix crash-on-invalid, improve error recovery, and test coverage for missing colon after access specifiers in C++
llvm-svn: 141852
2011-10-13 06:08:43 +00:00
Douglas Gregor e7a8e3b612 Introduce BalancedDelimiterTracker, to better track open/close
delimiter pairs and detect when we exceed the implementation limit for
nesting depth, from Aaron Ballman!

llvm-svn: 141782
2011-10-12 16:37:45 +00:00
John McCall 50a2c2c19d 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.

llvm-svn: 141738
2011-10-11 23:14:30 +00:00
Kaelyn Uhrain 85308c6ecd Add typo correction for type names.
The main motivation was to do typo correction in C++ "new" statements,
though picking it up in other places where type names are expected was
pretty much a freebie.

llvm-svn: 141621
2011-10-11 01:02:41 +00:00