| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
qualified name, e.g.,
foo::x
so that we retain the nested-name-specifier as written in the source
code and can reproduce that qualified name when printing the types
back (e.g., in diagnostics). This is PR3493, which won't be complete
until finished the other tasks mentioned near the end of this commit.
The parser's representation of nested-name-specifiers, CXXScopeSpec,
is now a bit fatter, because it needs to contain the scopes that
precede each '::' and keep track of whether the global scoping
operator '::' was at the beginning. For example, we need to keep track
of the leading '::', 'foo', and 'bar' in
::foo::bar::x
The Action's CXXScopeTy * is no longer a DeclContext *. It's now the
opaque version of the new NestedNameSpecifier, which contains a single
component of a nested-name-specifier (either a DeclContext * or a Type
*, bitmangled).
The new sugar type QualifiedNameType composes a sequence of
NestedNameSpecifiers with a representation of the type we're actually
referring to. At present, we only build QualifiedNameType nodes within
Sema::getTypeName. This will be extended to other type-constructing
actions (e.g., ActOnClassTemplateId).
Also on the way: QualifiedDeclRefExprs will also store a sequence of
NestedNameSpecifiers, so that we can print out the property
nested-name-specifier. I expect to also use this for handling
dependent names like Fibonacci<I - 1>::value.
llvm-svn: 67265
|
| |
|
|
| |
llvm-svn: 66661
|
| |
|
|
| |
llvm-svn: 66149
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
token.
For example:
Stack dump:
0. Program arguments: clang t.cpp
1. t.cpp:4:8: current parser token: ';'
2. t.cpp:3:1: parsing struct/union/class body 'x'
Abort
It is weird that the parser is always "underneath" any parse context
actions, but the parser is created first.
llvm-svn: 66148
|
| |
|
|
|
|
|
| |
locations that are the current tok loc. Note that inline C++ methods
have a big fixme that could cause a crash.
llvm-svn: 66113
|
| |
|
|
| |
llvm-svn: 65645
|
| |
|
|
| |
llvm-svn: 65641
|
| |
|
|
|
|
|
| |
useless to something more vague but hopefully more clear.
rdar://6624173
llvm-svn: 65639
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:
- Insert some new code (a text string) at a particular source
location
- Remove the code within a given range
- Replace the code within a given range with some new code (a text
string)
Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:
template<int I> class B { };
B<1000 >> 2> *b1;
we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:
test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
B<1000 >> 2> *b1;
^
( )
Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.
In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.
This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next
token).
llvm-svn: 65570
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
std::vector<int>::allocator_type
When we parse a template-id that names a type, it will become either a
template-id annotation (which is a parsed representation of a
template-id that has not yet been through semantic analysis) or a
typename annotation (where semantic analysis has resolved the
template-id to an actual type), depending on the context. We only
produce a type in contexts where we know that we only need type
information, e.g., in a type specifier. Otherwise, we create a
template-id annotation that can later be "upgraded" by transforming it
into a typename annotation when the parser needs a type. This occurs,
for example, when we've parsed "std::vector<int>" above and then see
the '::' after it. However, it means that when writing something like
this:
template<> class Outer::Inner<int> { ... };
We have two tokens to represent Outer::Inner<int>: one token for the
nested name specifier Outer::, and one template-id annotation token
for Inner<int>, which will be passed to semantic analysis to define
the class template specialization.
Most of the churn in the template tests in this patch come from an
improvement in our error recovery from ill-formed template-ids.
llvm-svn: 65467
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to a class template. For example, the template-id 'vector<int>' now
has a nice, sugary type in the type system. What we can do now:
- Parse template-ids like 'vector<int>' (where 'vector' names a
class template) and form proper types for them in the type system.
- Parse icky template-ids like 'A<5>' and 'A<(5 > 0)>' properly,
using (sadly) a bool in the parser to tell it whether '>' should
be treated as an operator or not.
This is a baby-step, with major problems and limitations:
- There are currently two ways that we handle template arguments
(whether they are types or expressions). These will be merged, and,
most likely, TemplateArg will disappear.
- We don't have any notion of the declaration of class template
specializations or of template instantiations, so all template-ids
are fancy names for 'int' :)
llvm-svn: 64153
|
| |
|
|
| |
llvm-svn: 64151
|
| |
|
|
|
|
|
|
| |
This shrinks OwningResult by one pointer. Since it is no longer larger than OwningPtr, merge the two.
This leads to simpler client code and speeds up my benchmark by 2.7%.
For some reason, this exposes a previously hidden bug, causing a regression in SemaCXX/condition.cpp.
llvm-svn: 63867
|
| |
|
|
| |
llvm-svn: 63750
|
| |
|
|
|
|
| |
http://llvm.org/bugs/show_bug.cgi?id=3475
llvm-svn: 63737
|
| |
|
|
|
|
| |
redundant #includes. Patch by Anders Johnsen!
llvm-svn: 63271
|
| |
|
|
|
|
| |
Since it doesn't return a bool, is shouldn't be prefixed with 'is'.
llvm-svn: 63226
|
| |
|
|
|
|
|
|
|
| |
.def file for each library. This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.
Patch by Anders Johnsen!
llvm-svn: 63111
|
| |
|
|
|
|
|
|
|
| |
special action, inside function prototype scope. This avoids confusion
when we try to inject these parameters into the scope of the function
body before the function itself has been added to the surrounding
scope. Fixes <rdar://problem/6097326>.
llvm-svn: 62849
|
| |
|
|
|
|
| |
misleading (and shorter).
llvm-svn: 62466
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that is neither a definition nor a forward declaration and where X has
not yet been declared as a tag, introduce a declaration
into the appropriate scope (which is likely *not* to be the current
scope). The rules for the placement of the declaration differ slightly
in C and C++, so we implement both and test the various corner
cases. This implementation isn't 100% correct due to some lingering
issues with the function prototype scope (for a function parameter
list) not being the same scope as the scope of the function
definition. Testcase is FIXME'd; this probably isn't an important issue.
Addresses <rdar://problem/6484805>.
llvm-svn: 62014
|
| |
|
|
|
|
| |
MaybeParseTypeSpecifier -> ParseOptionalTypeSpecifier.
llvm-svn: 61796
|
| |
|
|
|
|
| |
shorter and more accurate. The type name might not be qualified.
llvm-svn: 61788
|
| |
|
|
|
|
| |
isn't worth the complexity and the code already does a ton of lookahead.
llvm-svn: 61671
|
| |
|
|
|
|
| |
early exit for C and avoid template lookup for C.
llvm-svn: 61667
|
| |
|
|
|
|
|
| |
only be called when they might be needed now, so make them assert
that their current token is :: or identifier.
llvm-svn: 61662
|
| |
|
|
|
|
|
|
|
|
|
|
| |
verified to be simple type specifiers, so there is no need for it
to call TryAnnotateTypeOrScopeToken.
Make MaybeParseCXXScopeSpecifier reject ::new and ::delete with a
hard error now that it may never be transitively called in a
context where these are legal. This allows me to start
disentangling things more.
llvm-svn: 61659
|
| |
|
|
|
|
| |
applicable cases in ParseDeclarationSpecifiers.
llvm-svn: 61657
|
| |
|
|
|
|
|
| |
sure to pass it down. This makes the code a bit gross, I will clean
it up in subsequent commits.
llvm-svn: 61650
|
| |
|
|
| |
llvm-svn: 61642
|
| |
|
|
| |
llvm-svn: 61486
|
| |
|
|
|
|
| |
actually do anything with the template arguments, but they'll be used to create template declarations
llvm-svn: 61413
|
| |
|
|
|
|
|
|
| |
become useful or correct until we (1) parse template arguments
correctly, (2) have some way to turn template-ids into types,
declarators, etc., and (3) have a real representation of templates.
llvm-svn: 61208
|
| |
|
|
|
|
| |
Convert a few functions.
llvm-svn: 60983
|
| |
|
|
| |
llvm-svn: 60906
|
| |
|
|
| |
llvm-svn: 60888
|
| |
|
|
|
|
| |
explicitly calling EnterScope/ExitScope
llvm-svn: 60830
|
| |
|
|
|
|
| |
Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers.
llvm-svn: 60809
|
| |
|
|
| |
llvm-svn: 60791
|
| |
|
|
|
|
| |
pointers.
llvm-svn: 60782
|
| |
|
|
|
|
| |
variables.
llvm-svn: 60761
|
| |
|
|
|
|
|
| |
This is important because ParseDeclarationOrFunctionDefinition
skips to, but does not consume, an } on error.
llvm-svn: 60719
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
parameters, with some semantic analysis:
- Template parameters are introduced into template parameter scope
- Complain about template parameter shadowing (except in Microsoft mode)
Note that we leak template parameter declarations like crazy, a
problem we'll remedy once we actually create proper declarations for
templates.
Next up: dependent types and value-dependent/type-dependent
expressions.
llvm-svn: 60597
|
| |
|
|
| |
llvm-svn: 60384
|
| |
|
|
| |
llvm-svn: 60380
|
| |
|
|
| |
llvm-svn: 60119
|
| |
|
|
|
|
|
|
| |
-Change Parser::ParseCXXScopeSpecifier to MaybeParseCXXScopeSpecifier
-Remove Parser::isTokenCXXScopeSpecifier and fold it into MaybeParseCXXScopeSpecifier
-Rename Parser::TryAnnotateScopeToken to TryAnnotateCXXScopeToken and only allow it to be called when in C++
llvm-svn: 60117
|
| |
|
|
| |
llvm-svn: 59987
|
| |
|
|
| |
llvm-svn: 59921
|
| |
|
|
|
|
|
|
|
|
| |
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.
There is no functionality change with this patch.
llvm-svn: 59849
|