Commit Graph

445 Commits

Author SHA1 Message Date
Serge Pavlov b716b3ca1f Avoid spurious error messages if parent template class cannot be instantiated
Differential Revision: http://llvm-reviews.chandlerc.com/D924

llvm-svn: 188133
2013-08-10 05:54:47 +00:00
Larisse Voufo 39a1e507ff Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...
llvm-svn: 187762
2013-08-06 01:03:05 +00:00
David Majnemer 23252a3672 Parse: Don't consider attributes of broken member declarators
ParseCXXClassMemberDeclaration was trying to use the result of
ActOnCXXMemberDeclarator to attach it to some late parsed attributes.

However when failures arise, we have no decl to attach to which
eventually leads us to a NULL pointer dereference.

While we are here, clean up the code a bit.

Fixes PR16765

llvm-svn: 187557
2013-08-01 04:22:55 +00:00
Enea Zaffanella e05a3cf648 Improve clarity/consistency of a few UsingDecl methods and related helpers.
No functionality change.

In Sema helper functions:
 * renamed isTypeName as HasTypenameKeyword
In UsingDecl:
 * renamed get/setUsingLocation to get/setUsingLoc
 * renamed is/setTypeName as has/setTypename

llvm-svn: 186816
2013-07-22 10:54:09 +00:00
Rafael Espindola ab417699dd ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup and
Sema::ActOnDocumentableDecls.

Patch by Robert Wilhelm.

llvm-svn: 185931
2013-07-09 12:05:01 +00:00
Enea Zaffanella a90af72e8f Fixed source location info for UnaryTransformTypeLoc nodes.
llvm-svn: 185765
2013-07-06 18:54:58 +00:00
Craig Topper 2341c0d3b2 Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.
llvm-svn: 185610
2013-07-04 03:08:24 +00:00
Dmitri Gribenko 27cb3dd085 ArrayRef'ize Sema::CodeCompleteConstructorInitializer
Patch by Robert Wilhelm.

llvm-svn: 184675
2013-06-23 22:58:02 +00:00
Larisse Voufo b9bbaba6b1 Instantiation bug fix extension (cf. r184503) -- minor code fixes, including a typo that caused a runtime assertion after firing diagnosis for class definitions, with the 'template' keyword as template header, in friend declarations.
llvm-svn: 184634
2013-06-22 13:56:11 +00:00
Larisse Voufo 725de3e14f Bug Fix: Template explicit instantiations should not have definitions (FixIts yet to be tested.)
llvm-svn: 184503
2013-06-21 00:08:46 +00:00
Richard Trieu 30f93859a9 Fix for PR 16367, display the name of a function in a diagnostic instead of
showing "(null)".

llvm-svn: 184377
2013-06-19 22:25:01 +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
Dmitri Gribenko 139474d498 ArrayRef'ize Sema::ActOnMemInitializer
llvm-svn: 181565
2013-05-09 23:51:52 +00:00
Richard Smith 74aeef50a0 Implement C++1y decltype(auto).
llvm-svn: 180610
2013-04-26 16:15:35 +00:00
Richard Smith 7447af48b1 Implement special-case name lookup for inheriting constructors: member
using-declarations with names which look constructor-like are interpreted as
constructor names.

llvm-svn: 177957
2013-03-26 01:15:19 +00:00
Alexey Bataev a769e07232 OpenMP threadprivate directive parsing and semantic analysis
llvm-svn: 177705
2013-03-22 06:34:35 +00:00
Richard Smith 4cabd04e75 Don't accidentally and silently accept C++11 attributes in decl-specifier-seqs
in C++98.

llvm-svn: 175879
2013-02-22 09:15:49 +00:00
Richard Smith 434516c50c Don't skip '_Alignas' when disambiguating 'final'. '_Alignas' can't appear here,
and we used to assert if it did.

llvm-svn: 175866
2013-02-22 06:46:23 +00:00
Richard Smith 54ecd9863f Process and handle attributes on conditions and for loop variables. Process and
diagnose attributes on alias declarations, using directives, and attribute
declarations.

llvm-svn: 175649
2013-02-20 19:22:51 +00:00
Richard Smith 4c96e99235 PR15300: Support C++11 attributes on base-specifiers. We don't support any such
attributes yet, so just issue the appropriate diagnostics. Also generalize the
fixit for attributes-in-the-wrong-place code and reuse it here, if attributes
are placed after the access-specifier or 'virtual' in a base specifier.

llvm-svn: 175575
2013-02-19 23:47:15 +00:00
Jordan Rose a7d03840e6 Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

llvm-svn: 174768
2013-02-08 22:30:41 +00:00
David Blaikie 35506f8202 Provide a fixit for constexpr non-static data members.
If the member has an initializer, assume it was probably intended to be static
and suggest/recover with that.

If the member doesn't have an initializer, assume it was probably intended to
be const instead of constexpr and suggest that.

(if the attempt to apply these changes fails, don't make any suggestion &
produce the same diagnostic experience as before. The only case where this can
come up that I know of is with a mutable constexpr with an initializer, since
mutable is incompatible with static (but it's already incompatible with
const anyway))

llvm-svn: 173873
2013-01-30 01:22:18 +00:00
Richard Smith 810ad3eb44 Downgrade 'attribute ignored when parsing type' from error to warning, to match
the diagnostic's warn_ name. Switch some places (notably C++11 attributes)
which really wanted an error over to a different diagnostic. Finally, suppress
the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing
diagnostics in important system headers.

llvm-svn: 173788
2013-01-29 10:02:16 +00:00
Richard Smith 52c5b87cc9 PR15017: A '>' can appear after a type-specifier in a template-argument-list.
It turns out that there's no correctness bug here (because we can't have a type
definition in this location), but there was a diagnostic bug.

llvm-svn: 173766
2013-01-29 04:13:32 +00:00
Richard Smith 1ac67d1530 Fix five more cases of tokens which can legally follow a type specifier.
llvm-svn: 172886
2013-01-19 03:48:05 +00:00
Nico Weber 0bba2d11d0 Fix parsing of class specifiers before '\n' 'operator'.
r159549 / r159164 regressed clang to reject

  struct s {};
  struct s
  operator++(struct s a)
  { return a; }

This fixes the regression. Richard, pleas check if this looks right.

llvm-svn: 172834
2013-01-18 18:41:42 +00:00
David Blaikie 3fc2f9114a ArrayRef-ize some ctor initializer related APIs
llvm-svn: 172701
2013-01-17 05:26:25 +00:00
Richard Smith 10876ef571 Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).

llvm-svn: 172691
2013-01-17 01:30:42 +00:00
Dmitri Gribenko f857950d39 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323
2013-01-12 19:30:44 +00:00
Rafael Espindola 0a67e2fc8b Tighten types a bit. No functionality change.
llvm-svn: 171894
2013-01-08 20:44:06 +00:00
Michael Han 309af291ef Add fixit hints for misplaced C++11 attributes around class specifiers.
Following r168626, in class declaration or definition, there are a combination of syntactic locations 
where C++11 attributes could appear, and among those the only valid location permitted by standard is
between class-key and class-name. So for those attributes appear at wrong locations, fixit is used to 
move them to expected location and we recover by applying them to the class specifier.
 

llvm-svn: 171757
2013-01-07 16:57:11 +00:00
Richard Smith 89645bc888 s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby 'C++0x' comments.
llvm-svn: 171372
2013-01-02 12:01:23 +00:00
Richard Smith 2bf7fdb723 s/CPlusPlus0x/CPlusPlus11/g
llvm-svn: 171367
2013-01-02 11:42:31 +00:00
Bill Wendling 4442605f18 Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.
llvm-svn: 170721
2012-12-20 19:22:21 +00:00
Bill Wendling 7967fc14b9 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170500
2012-12-19 07:18:12 +00:00
Argyrios Kyrtzidis e6f6913bec [parser] Push a semi token for recovery only when it is actually missing.
llvm-svn: 170363
2012-12-17 20:10:43 +00:00
Richard Smith c88e40450d PR14549. Don't assert if we see an incomplete decltype specifier at the end of the file.
llvm-svn: 169688
2012-12-09 04:17:57 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Michael Han ddc016d4d7 Implement C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains to a friend declaration, that declaration shall be a definition.
llvm-svn: 168826
2012-11-28 23:17:40 +00:00
Michael Han 9407e50b04 Improve diagnostic on C++11 attribute specifiers that appear at wrong syntactic locations around class specifiers.
This change list implemented logic that explicitly detects several combinations of locations where C++11 attribute
specifiers might be incorrectly placed within a class specifier. Previously we emit generic diagnostics like 
"expected identifier" for such cases; now we emit specific diagnostic against the misplaced attributes, this also 
fixed a bug in old code where attributes appear at legitimate locations were incorrectly rejected.

Thanks to Richard Smith for reviewing!

llvm-svn: 168626
2012-11-26 22:54:45 +00:00
Andy Gibbs a8df57a962 Made the "expected string literal" diagnostic more expressive
llvm-svn: 168267
2012-11-17 19:16:52 +00:00
Richard Smith 2603b096df PR9903: Recover from a member functon declared with the 'typedef' specifier by
dropping the specifier, just like we do for non-member functions and function
templates declared 'typedef'. Patch by Brian Brooks!

llvm-svn: 168108
2012-11-15 22:54:20 +00:00
Nico Weber 729f1e2a1c Fix crash on missing namespace name in namespace alias definition -- PR14085.
Patch from Brian Brooks <brooks.brian@gmail.com>!

llvm-svn: 166893
2012-10-27 23:44:27 +00:00
Argyrios Kyrtzidis c38395a0f7 In Parser::ParseDecltypeSpecifier, make sure the end location it returns
is at the end of parsed tokens when an error occurs, otherwise we'll hit
an assertion when trying to annotate the decltype tokens.

llvm-svn: 166826
2012-10-26 22:53:44 +00:00
Argyrios Kyrtzidis 5c2021bf2a Handle a "#pragma options align" inside a class.
llvm-svn: 165810
2012-10-12 17:39:59 +00:00
Michael Han 23214e5046 Improve C++11 attribute parsing.
- General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST.
- Add support to parse arguments of attributes that in 'gnu' namespace.
- Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic.

llvm-svn: 165082
2012-10-03 01:56:22 +00:00
John McCall db632ac004 Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!

llvm-svn: 164590
2012-09-25 07:32:39 +00:00
Richard Smith 7696571d2b Recover properly after a parse error in a static_assert declaration.
llvm-svn: 163826
2012-09-13 19:12:50 +00:00
Joao Matos e9a3ed4d71 Normalize line endings of r163013 (part 2).
llvm-svn: 163032
2012-08-31 22:18:20 +00:00
Joao Matos dc86f94f62 Improved MSVC __interface support by adding first class support for it, instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins.
llvm-svn: 163013
2012-08-31 18:45:21 +00:00