Commit Graph

1397 Commits

Author SHA1 Message Date
Francois Pichet a5b3fcbc02 Add support for _if_exists and __if_not_exists at namespace/global scope.
llvm-svn: 131050
2011-05-07 17:30:27 +00:00
Alexis Hunt 83dc3e89c3 Per Richard's suggestion, rename DefLoc to DefaultLoc where it appears.
llvm-svn: 131018
2011-05-06 21:24:28 +00:00
Francois Pichet 4a7de3eb2c Add support for Microsoft __if_exists and __if_not_exists construct inside function definition.
Allow to include or exclude code depending on if a symbol exists or not. Just like a #ifdef but for C/C++ symbols.

More doc: http://msdn.microsoft.com/en-us/library/x7wy9xh3(v=VS.100).aspx

Support at class and namespace scopes will be added later.

llvm-svn: 131014
2011-05-06 20:48:22 +00:00
Alexis Hunt 5dafebc89f Do defaulted constructors properly.
Explictly defaultedness is correctly reflected on the AST, but there are
no changes to how that affects the definition of functions or much else
really.

llvm-svn: 130974
2011-05-06 01:42:00 +00:00
Alexis Hunt 58dad7d978 Revert r130912 in order to approach defaulted functions from the other
direction and not introduce things in the wrong place three different
times.

llvm-svn: 130968
2011-05-06 00:11:07 +00:00
Richard Smith 14034026d6 Slight tweak to alias template error handling: don't guess that a template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic.
llvm-svn: 130961
2011-05-05 22:36:10 +00:00
Richard Smith 3f1b5d077b Implement support for C++0x alias templates.
llvm-svn: 130953
2011-05-05 21:57:07 +00:00
Alexis Hunt 1adeff92bc Implement some framework for defaulted constructors.
There's some unused stuff for now.

llvm-svn: 130912
2011-05-05 03:36:28 +00:00
Benjamin Kramer ffe4ec45f3 Remove unused but set variable.
llvm-svn: 130776
2011-05-03 18:46:17 +00:00
Argyrios Kyrtzidis 13935670e4 Fix a double free when parsing malformed code. Fixes rdar://9173693.
llvm-svn: 130775
2011-05-03 18:45:38 +00:00
Chandler Carruth 7c9856deb3 When parsing a template friend declaration we dropped the template
parameters on the floor in certain cases:
class X {
  template <typename T> friend typename A<T>::Foo;
};

This was parsed as a *non* template friend declaration some how, and
received an ExtWarn. Fixing the parser to actually provide the template
parameters to the freestanding declaration parse triggers the code which
specifically looks for such constructs and hard errors on them.

Along the way, this prevents us from trying to instantiate constructs
like the above inside of a outer template. This is important as loosing
the template parameters means we don't have a well formed declaration
and template instantiation will be unable to rebuild the AST. That fixes
a crash in the GCC test suite.

llvm-svn: 130772
2011-05-03 18:35:10 +00:00
Abramo Bagnara 4d42399d46 Fixed source range for extern linkage specification without braces.
llvm-svn: 130660
2011-05-01 16:25:54 +00:00
Chandler Carruth f2f5652d3d Remove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.
As might be surmised from their names, these aren't type traits, they're
expression traits. Amazingly enough, they're expression traits that we
have, and fully implement. These "type" traits are even parsed from the
same tokens as the expression traits. Luckily, the parser only tried the
expression trait parsing for these tokens, so this was all just a pile
of dead code.

llvm-svn: 130643
2011-05-01 07:23:14 +00:00
Douglas Gregor f1fce5d3ef White-list yet more type trait names, since they're used as
identifiers in libc++.

llvm-svn: 130508
2011-04-29 15:31:39 +00:00
Douglas Gregor 63180b1190 libstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new type trait __is_same
llvm-svn: 130468
2011-04-29 01:38:03 +00:00
Douglas Gregor 068730992c libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
as a keyword for the __is_signed type trait. Cope with this conflict
via some hackish recovery: if we see a declaration of the form

 static const bool __is_signed

then we stop treating __is_signed as a keyword and instead treat it as
an identifier. It's ugly, but it's better than making the __is_signed
type trait conditional on some language flag. Fixes PR9804.

llvm-svn: 130399
2011-04-28 15:48:45 +00:00
Francois Pichet bfaf477a99 SEH was crashing under -fms-extensions.
llvm-svn: 130377
2011-04-28 03:14:31 +00:00
Francois Pichet 84133e41be Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.
Otherwise statements like:
  __int64 var = __int64(0);

would be expanded to:
  long long var = long long(0);

and fail to compile.

llvm-svn: 130369
2011-04-28 01:59:37 +00:00
John Wiegley 1c0675e155 Parsing/AST support for Structured Exception Handling
Patch authored by Sohail Somani.

Provide parsing and AST support for Windows structured exception handling.

llvm-svn: 130366
2011-04-28 01:08:34 +00:00
John Wiegley 6242b6a688 Implementation of Embarcadero array type traits
Patch authored by John Wiegley.

These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).

llvm-svn: 130351
2011-04-28 00:16:57 +00:00
John Wiegley 65497cce20 t/clang/type-traits
Patch authored by John Wiegley.

These type traits are used for parsing code that employs certain features of
the Embarcadero C++ compiler.  Several of these constructs are also desired by
libc++, according to its project pages (such as __is_standard_layout).

llvm-svn: 130342
2011-04-27 23:09:49 +00:00
Douglas Gregor da6c89de48 Introduce a new parser annotation token for primary expressions. When
ClassifyName() builds a primary expression, generate one of these
annotation tokens rather than jumping into the parser.

llvm-svn: 130297
2011-04-27 06:18:01 +00:00
Douglas Gregor 9b2d706e05 Clean out some cruft I introduced when adding Sema::ClassifyName()
llvm-svn: 130295
2011-04-27 05:44:51 +00:00
Douglas Gregor 19b7acff10 Simplify the parser's handling of Sema::ClassifyName() for types, by
creating a type-annotation token rather than jumping into the
declaration parsing.

llvm-svn: 130293
2011-04-27 05:41:15 +00:00
Argyrios Kyrtzidis f7620e4d49 If a null statement was preceded by an empty macro keep its instantiation source location
in NullStmt.

llvm-svn: 130289
2011-04-27 05:04:02 +00:00
Douglas Gregor 8b02cd0bea 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.

llvm-svn: 130288
2011-04-27 04:48:22 +00:00
Fariborz Jahanian 743dda49d9 Recognize gcc's ms_struct pragma (and ignore for now).
This is wip.

llvm-svn: 130138
2011-04-25 18:49:15 +00:00
Douglas Gregor b90f5185b6 When Sema::ClassifyName() finds an invalid ivar reference, return an
invalid expression rather than the far-more-generic "error". Fixes a
mild regression in error recovery uncovered by the GCC testsuite.

llvm-svn: 130128
2011-04-25 15:05:41 +00:00
Chandler Carruth bc0f9aeac3 Remove some more hard CR-LF lines. These were particularly weird as they were
only a few lines of the file. Also set their properties to have explicitly
native eol sytle.

llvm-svn: 130124
2011-04-25 07:09:43 +00:00
John Wiegley f9f6584e95 t/clang/expr-traits
Patch authored by David Abrahams.

These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.

llvm-svn: 130122
2011-04-25 06:54:41 +00:00
Sebastian Redl 83f3b859ab Make the invalid declarator recovery when parsing members work the same as when parsing global decls. It's still rather broken (skipping much too far when the declarator belongs to a function definition), but at least not so broken as to mismatch braces. Tested by the removal of the fixme in the template test case.
llvm-svn: 130101
2011-04-24 16:27:48 +00:00
Francois Pichet dd876125df Downgrade unnecessary "typename" from error to warning in Microsoft mode.
This fixes 1 error when parsing MSVC 2008 headers with clang. 

Must "return true;" even if it is a warning because the rest of the code path assumes that SS is set to something. The parser will get back on its feet and continue parsing the rest of the declaration correctly so it is not a problem.

llvm-svn: 130088
2011-04-24 11:24:13 +00:00
Douglas Gregor 0e7dde535d 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>.

llvm-svn: 130082
2011-04-24 05:37:28 +00:00
Chandler Carruth 65fa1fd18e Add support for '__is_literal_type' spelling of the existing
'__is_literal' type trait for GCC compatibility. At least one relased
version if libstdc++ uses this name for the trait despite it not being
documented anywhere.

llvm-svn: 130078
2011-04-24 02:49:28 +00:00
Francois Pichet a7d337d196 Remove unnecessary const away cast in LateTemplateParserCallback.
llvm-svn: 130058
2011-04-23 11:52:20 +00:00
Chandler Carruth a3e1f9a02c Implement basic __is_trivial type-trait support, enough to close PR9472.
This introduces a few APIs on the AST to bundle up the standard-based
logic so that programmatic clients have access to exactly the same
behavior.

There is only one serious FIXME here: checking for non-trivial move
constructors and move assignment operators. Those bits need to be added
to the declaration and accessors provided.

This implementation should be enough for the uses of __is_trivial in
libstdc++ 4.6's C++98 library implementation.

Ideas for more thorough test cases or any edge cases missing would be
appreciated. =D

llvm-svn: 130057
2011-04-23 10:47:28 +00:00
Chandler Carruth 7980348fcf Sort the type traits in a few places where they weren't previously
sorted in order to prepare for adding some new ones.

llvm-svn: 130056
2011-04-23 10:47:20 +00:00
Argyrios Kyrtzidis 7d94c9277a Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.
llvm-svn: 130042
2011-04-23 01:04:12 +00:00
Francois Pichet dcb3ebeb2c Correctly emit a diagnostic for multiple templated function definitions in -flate-template-parsing mode.
llvm-svn: 130030
2011-04-22 23:20:44 +00:00
Francois Pichet 1c229c0472 Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup.
Using this flag is necessary for compatibility with Microsoft template code.
This also provides some parsing speed improvement.

llvm-svn: 130022
2011-04-22 22:18:13 +00:00
Fariborz Jahanian c057794adb Fixes an instance method meta-data generation bug in
ObjC NeXt runtime where method pointer registered in
metadata belongs to an unrelated method. Ast part of this fix,
I turned at @end missing warning (for class
implementations) into an error as we can never
be sure that meta-data being generated is correct.
// rdar://9072317

llvm-svn: 130019
2011-04-22 22:02:28 +00:00
Francois Pichet 9392165a17 For consistency, change suffix from war_ to warn_ for some Microsoft warnings I introduced lately.
llvm-svn: 129986
2011-04-22 08:25:24 +00:00
Richard Smith d4257d847e Fix gcc warning. Add parens to this assert, incidentally reassociating it, but the condition is the same either way.
llvm-svn: 129948
2011-04-21 22:48:40 +00:00
Richard Trieu 2c850c0980 Add a fixit suggest for missing case keywords inside a switch scope. For instance, in the following code, 'case ' will be suggested before the '1:'
switch (x) {
  1: return 0;
  default: return 1;
}

llvm-svn: 129943
2011-04-21 21:44:26 +00:00
Argyrios Kyrtzidis 1f329402ae Fixit suggestion for adding missing tag name should have a space after the tag name. Fixes rdar://9295072
llvm-svn: 129917
2011-04-21 17:29:47 +00:00
Fariborz Jahanian 2b059998f7 Avoid superfluous warning after an error is detcted and reported.
// rdar://9132143

llvm-svn: 129822
2011-04-19 21:42:37 +00:00
Douglas Gregor a3a020ae0b Parse GNU-style attributes prior to the type-id/new-type-id in a C++
"new" expression. This matches GCC's parser. Test is forthcoming.

llvm-svn: 129592
2011-04-15 19:40:02 +00:00
Richard Smith dda56e4b4a Support for C++11 (non-template) alias declarations.
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Peter Collingbourne 3d9cbdc3e6 C1X: implement static asserts
llvm-svn: 129555
2011-04-15 00:35:57 +00:00
Peter Collingbourne 9114759641 C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages.  The syntax is the same as for C1X.

llvm-svn: 129554
2011-04-15 00:35:48 +00:00
Tanya Lattner ee840b85b1 Do not expand the opencl pragma names. This is so you can also have a define named the samed as the pragma and they do not interfere (ie. cl_khr_fp64).
llvm-svn: 129549
2011-04-14 23:35:31 +00:00
Douglas Gregor 6ca6410e3a If the declaration of a C++ member function with an inline definition
is so broken that Sema can't form a declaration for it, don't bother
trying to parse the definition later. Fixes <rdar://problem/9221993>.

llvm-svn: 129547
2011-04-14 23:19:27 +00:00
Richard Smith 02e85f3bc5 Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).
llvm-svn: 129541
2011-04-14 22:09:26 +00:00
Richard Smith 55858499e2 Detect when the string "<::" is found in code after a cast or template name and is interpreted as "[:" because of the digraph "<:". When found, give an error with a fix-it to add whitespace between the "<" and "::".
Patch by Richard Trieu! Plus a small tweak from me to deal with one of the tokens coming from a macro.

llvm-svn: 129540
2011-04-14 21:45:45 +00:00
Douglas Gregor 23c8476748 Parse an '@' in an Objective-C++ class member specification,
diagnosing it as an error rather than looping infinitely. Also,
explicitly disallow @defs in Objective-C++. Fixes <rdar://problem/9260136>.

llvm-svn: 129521
2011-04-14 17:21:19 +00:00
John McCall 39439739cf Fix a bunch of major problems with __unknown_anytype and properly test
for them.  The only major missing feature is references.

llvm-svn: 129234
2011-04-09 22:50:59 +00:00
John McCall c5e6b97523 Diagnose a missing ')' on what looks like a statement expression.
A situation where we can get an invalid ExprResult without an error.
Fixes PR8394.  Patch by Justin Bogner!

llvm-svn: 128979
2011-04-06 02:35:25 +00:00
Francois Pichet 4e7a2c09b2 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.

llvm-svn: 128387
2011-03-27 19:41:34 +00:00
Chris Lattner 85222c6b2f fix the second part of rdar://8366474 - clang fails to parse ObjC selectors with '::', when :: isn't the first part of the selector.
llvm-svn: 128344
2011-03-26 18:11:38 +00:00
Douglas Gregor 7ab142b55a Extend the new 'availability' attribute with support for an
'unavailable' argument, which specifies that the declaration to which
the attribute appertains is unavailable on that platform.

llvm-svn: 128329
2011-03-26 03:35:55 +00:00
John McCall 405988b97c Fix the recovery from missing semis on @property declarations to not consume
the following '@'.  Conceivably, we could skip tokens until something that
can validly start an @interface declaration here, but it's not clear that
it matters.

llvm-svn: 128325
2011-03-26 01:53:26 +00:00
Anders Carlsson 65c76d3826 Fixup comments.
llvm-svn: 128280
2011-03-25 14:55:14 +00:00
Anders Carlsson cafbab7443 Remove the last of ClassVirtSpecifiers.
llvm-svn: 128279
2011-03-25 14:53:29 +00:00
Anders Carlsson f9eb63beb7 Replace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to only parse an optional 'final' keyword.
llvm-svn: 128278
2011-03-25 14:46:08 +00:00
Anders Carlsson 30f29444c0 Get rid of handling of the 'explicit' keyword from class-head. We still parse it though, although that will change shortly.
llvm-svn: 128277
2011-03-25 14:31:08 +00:00
Anders Carlsson 806aa66e8f Remove warnings about using override control keywords in inline function definitions; they will be allowed in the next C++0x draft.
llvm-svn: 128273
2011-03-25 11:28:25 +00:00
Anders Carlsson debd3ec14d Remove 'new' from virt-specifier since it's going to be removed in the next C++0x draft
llvm-svn: 128271
2011-03-25 11:19:41 +00:00
John McCall 084e83dfe7 Insomniac refactoring: change how the parser allocates attributes so that
AttributeLists do not accumulate over the lifetime of parsing, but are
instead reused.  Also make the arguments array not require a separate
allocation, and make availability attributes store their stuff in
augmented memory, too.

llvm-svn: 128209
2011-03-24 11:26:52 +00:00
John McCall c23308ceea Call out ObjC parameter types as a different kind of declarator context
from a normal type-spec, just for completeness.

llvm-svn: 128185
2011-03-23 23:43:04 +00:00
Douglas Gregor 20b2ebd785 Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.

llvm-svn: 128127
2011-03-23 00:50:03 +00:00
Ted Kremenek 4c9d46b310 Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed within ParseAST. This avoids double crashes
during crash recovery.

llvm-svn: 128056
2011-03-22 01:15:17 +00:00
Peter Collingbourne 599cb8e430 Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers.  Patch originally by ARM;
language-specific address space support by myself.

llvm-svn: 127915
2011-03-18 22:38:29 +00:00
Ted Kremenek c93cf2e912 Construct 'Sema' object on the stack, so that crash recovery can recovery it's associated resources without walking over dead stack space.
llvm-svn: 127864
2011-03-18 03:44:21 +00:00
Ted Kremenek 750028b6f4 Use CrashRecoveryContextCleanup objects to release resources associated with Sema during a crash while parsing.
llvm-svn: 127850
2011-03-18 02:06:53 +00:00
Abramo Bagnara 9875a3ce70 Use ElaboratedType also for C.
llvm-svn: 127755
2011-03-16 20:16:18 +00:00
Douglas Gregor a0ff0c34a7 Make sure that we always pop a function's scope *before* we call
ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that
we diagnose undefined labels before the jump-scope checker gets run,
since the jump-scope checker requires (as its invariant) that all of
the GotoStmts be wired up correctly.

Fixes PR9495.

llvm-svn: 127738
2011-03-16 17:05:57 +00:00
Douglas Gregor 1e98986160 Disable 'auto' type deduction in Objective-C. It likes 'id' a bit too
much to be useful.

llvm-svn: 127625
2011-03-14 21:43:30 +00:00
Fariborz Jahanian c677f69397 Place duplicate argument declaration in in
method prototypes under the -Wduplicate-method-arg and
turn it off by default.

llvm-svn: 127552
2011-03-12 18:54:30 +00:00
Sebastian Redl fa453cfdc3 Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

llvm-svn: 127537
2011-03-12 11:50:43 +00:00
Abramo Bagnara f2a79d94e4 Forgotten part of previous commit.
llvm-svn: 127536
2011-03-12 11:17:06 +00:00
Douglas Gregor 1beec45a61 Fixes for some more expressions containing function templateids that
should be resolvable, from Faisal Vali!

llvm-svn: 127521
2011-03-12 01:48:56 +00:00
Douglas Gregor e9e27d95db Implement a hack intended to allow Clang to parse libstdc++ 4.5's
headers, which use C++0x generalized initializer lists. Per PR7069, it
appears that the only use is as the return type of a function, so this
commit enables this extension just in that narrow case. If it's enough
for libstdc++ 4.5, or if it can be trivially extended to work with
libstdc++ 4.5, we'll keep it. Otherwise, or if this breaks anything,
we'll revert and wait for the real feature.

llvm-svn: 127507
2011-03-11 23:10:44 +00:00
Peter Collingbourne e190dee7a5 Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof.  Original
patch by Guy Benyei.

llvm-svn: 127475
2011-03-11 19:24:49 +00:00
Douglas Gregor 95d3e370f4 Clarify the context in which an Objective-C type name is being parsed
by using an enumeration rather than a boolean value. No functionality
change.

llvm-svn: 127259
2011-03-08 19:17:54 +00:00
Abramo Bagnara ea94788cf4 Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source range for declarations using postfix types.
llvm-svn: 127251
2011-03-08 16:41:52 +00:00
Abramo Bagnara b5545be14b Fixed NamespaceDecl source range.
llvm-svn: 127242
2011-03-08 12:38:20 +00:00
Sebastian Redl 802a45332a Propagate new-style exception spec information to Declarator.
llvm-svn: 127111
2011-03-05 22:42:13 +00:00
Abramo Bagnara 1c3af96724 Fixed LabelDecl source range and cleaned creation code.
llvm-svn: 127094
2011-03-05 18:21:20 +00:00
Sebastian Redl 965b0e3106 Parser support for noexcept specifications.
llvm-svn: 127086
2011-03-05 14:45:16 +00:00
Douglas Gregor 8b6070bb9d Teach Sema::ActOnCXXNestedNameSpecifier and Sema::CheckTemplateIdType
to cope with non-type templates by providing appropriate
errors. Previously, we would either assert, crash, or silently build a
dependent type when we shouldn't. Fixes PR9226.

llvm-svn: 127037
2011-03-04 21:37:14 +00:00
Abramo Bagnara 348823aa36 Fixed source range for FileScopeAsmDecl. Others source range fixes will follow.
llvm-svn: 126939
2011-03-03 14:20:18 +00:00
Douglas Gregor e7c2065379 Push nested-name-specifier source-location information into dependent
template specialization types. This also required some parser tweaks,
since we were losing track of the nested-name-specifier's source
location information in several places in the parser. Other notable
changes this required:

  - Sema::ActOnTagTemplateIdType now type-checks and forms the
    appropriate type nodes (+ source-location information) for an
    elaborated-type-specifier ending in a template-id. Previously, we
    used a combination of ActOnTemplateIdType and
    ActOnTagTemplateIdType that resulted in an ElaboratedType wrapped
    around a DependentTemplateSpecializationType, which duplicated the
    keyword ("class", "struct", etc.) and nested-name-specifier
    storage.

  - Sema::ActOnTemplateIdType now gets a nested-name-specifier, which
    it places into the returned type-source location information.

  - Sema::ActOnDependentTag now creates types with source-location
    information.

llvm-svn: 126808
2011-03-02 00:47:37 +00:00
Douglas Gregor 844cb50266 Reinstate the introduction of source-location information for
nested-name-speciciers within elaborated type names, e.g.,
 
  enum clang::NestedNameSpecifier::SpecifierKind

Fixes in this iteration include:

  (1) Compute the type-source range properly for a dependent template
  specialization type that starts with "template template-id ::", as
  in a member access expression

    dep->template f<T>::f()

  This is a latent bug I triggered with this change (because now we're
  checking the computed source ranges for dependent template
  specialization types). But the real problem was...

  (2) Make sure to set the qualifier range on a dependent template
  specialization type appropriately. This will go away once we push
  nested-name-specifier locations into dependent template
  specialization types, but it was the source of the
  valgrind errors on the buildbots.
  

llvm-svn: 126765
2011-03-01 18:12:44 +00:00
Douglas Gregor b3a58b08e0 Revert r126748, my second attempt at nested-name-specifier source
location information for elaborated types. *sigh*

llvm-svn: 126753
2011-03-01 17:25:47 +00:00
Douglas Gregor bf5fe47b12 Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.

The commit message from r126737:

Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.

llvm-svn: 126748
2011-03-01 16:31:39 +00:00
Douglas Gregor 62a60c50f4 Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.
llvm-svn: 126746
2011-03-01 15:34:37 +00:00
Douglas Gregor 9720642c68 Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.

llvm-svn: 126737
2011-03-01 03:11:17 +00:00
Douglas Gregor ff42ec5895 Fix some regressions in the GCC testsuite due to bad souce-location
information. Fixes <rdar://problem/9063643>.

llvm-svn: 126721
2011-03-01 00:34:57 +00:00
Peter Collingbourne 2f1e36bfd0 Rename tok::eom to tok::eod.
The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.

llvm-svn: 126631
2011-02-28 02:37:51 +00:00