Граф коммитов

1299 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 250e7a74d5 When we're inserting a synthesized label declaration for a
forward-looking "goto" statement, make sure to insert it *after* the
last declaration in the identifier resolver's declaration chain that
is either outside of the function/block/method's scope or that is
declared in that function/block/method's specific scope. Previously,
we could end up inserting the label ahead of declarations in inner
scopes, confusing C++ name lookup.

Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>.

Note that the crash-on-invalid PR9495 is *not* fixed. That's a
separate issue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127737 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 16:39:03 +00:00
Douglas Gregor 7cbc558ffd When synthesizing a label declaration based on a goto statement that
cannot yet be resolved, be sure to push the new label declaration into
the right place within the identifier chain. Otherwise, name lookup in
C++ gets confused when searching for names that are lexically closer
than the label. Fixes PR9463.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127623 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 21:19:51 +00:00
Sebastian Redl 8999fe1bc3 Make deallocation functions implicitly noexcept in C++0x.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127596 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 18:08:30 +00:00
Sebastian Redl 60618fa7f8 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 11:50:43 +00:00
Abramo Bagnara c57c17dced Avoid do drop outer template parameter lists on the floor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127404 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 13:28:31 +00:00
Daniel Dunbar 975cc644d5 Revert r127206 "Detect attempts to provide a specialization of a function within
a...", it appears to cause us to reject various valid codes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127373 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 23:24:34 +00:00
Abramo Bagnara ba877adeb4 Fixed InnerLocStart.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 14:09:51 +00:00
Fariborz Jahanian 02b0d651ec Warn on usage of unavailable objc 'class' in
varienty of cases. // rdar://9092208


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127257 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:12:46 +00:00
Douglas Gregor f52516038a Teach libclang's token-annotation logic about context-sensitive
keywords for Objective-C+ and C++0x. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127253 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 17:10:18 +00:00
Abramo Bagnara a2026c96d3 Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source range for declarations using postfix types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 16:41:52 +00:00
Abramo Bagnara ff676cb48f Fixed source range for all DeclaratorDecl's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127225 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 08:55:46 +00:00
Douglas Gregor db93fdee6c Detect attempts to provide a specialization of a function within a
dependent scope and produce an error (rather than crashing). Fixes PR8979.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127206 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 02:04:14 +00:00
Argyrios Kyrtzidis d97cec3deb g++ is more permissive regarding flexible arrays.
It will accept flexible array in union and also as the sole element of a struct/class.

Fixes rdar://9065507.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 20:04:04 +00:00
Douglas Gregor cc20945c78 Support explicit template specialization and instantiation for members
of a C++0x inline namespace within enclosing namespaces, as noted in
C++0x [namespace.def]p8.

Fixes <rdar://problem/9006349>, a libc++ failure where Clang was
rejected an explicit specialization of std::swap (since libc++ puts it
into an inline, versioned namespace std::__1).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127162 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 16:54:27 +00:00
Abramo Bagnara a868c3799b Completed source ranges fixes for all classes inheriting from TypeDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127120 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 16:09:14 +00:00
Abramo Bagnara 344577e6b5 Fixed TypedefDecl and TemplateTypeParameter source range.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127119 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 15:48:19 +00:00
Sebastian Redl 6e5d319b67 Propagate new-style exception spec information to Declarator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127111 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 22:42:13 +00:00
Douglas Gregor 26cd44da98 When diagnostics are suppressed (e.g., because of code completion), don't trigger the ExprTemplates.empty() check at the end of a function body
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127046 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 23:08:02 +00:00
Douglas Gregor cb710a4df5 Diagnose destructor templates. Fixes PR7904.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 22:45:55 +00:00
Abramo Bagnara 21e006e51a Fixed source range for FileScopeAsmDecl. Others source range fixes will follow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126939 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 14:20:18 +00:00
Douglas Gregor 1e284a703c Remove cruft
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126888 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 21:57:24 +00:00
Douglas Gregor 0a9beb52ba Force CaseStmt to store its child statements in source-code order,
which is important for libclang's token-annotation and
where's-my-cursor functionality. Fixes <rdar://problem/9004439>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126887 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 21:45:00 +00:00
John McCall eca5d22c16 Support a new InheritableAttr subclass, InheritableParamAttr, which is
used for attributes that are okay to inherit when written on a parameter.
Dependent on LLVM r126827.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126828 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 04:00:57 +00:00
Douglas Gregor 9e876876af 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.
  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126765 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 18:12:44 +00:00
Douglas Gregor 2786864406 Revert r126748, my second attempt at nested-name-specifier source
location information for elaborated types. *sigh*


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 17:25:47 +00:00
Douglas Gregor be38c5f5d8 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126748 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 16:31:39 +00:00
Douglas Gregor 44cd9f9d68 Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126746 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 15:34:37 +00:00
Douglas Gregor 239cbb023c 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126737 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 03:11:17 +00:00
Douglas Gregor e29425bd22 Teach Sema::CheckTypenameType to use nested-name-specifiers with
source-location information. We don't actually preserve this
information in any of the resulting TypeLocs (yet), so it doesn't
matter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126693 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28 22:42:13 +00:00
Douglas Gregor c22b5fff39 Use NestedNameSpecifierLoc within out-of-line variables, function, and
tag definitions. Also, add support for template instantiation of
NestedNameSpecifierLocs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126470 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 02:25:35 +00:00
Ted Kremenek 3ed6fc08a9 Issue AnalysisBasedWarnings as part of calling Sema::PopBlockOrFunctionScope(). No real functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23 01:51:48 +00:00
Richard Smith 406c38e8c1 Fix PR9276: We were missing the checks for auto deducing to different types in the same declaration group in the template instantiation case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126279 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23 00:37:57 +00:00
Richard Smith 483b9f3bc0 Tweaks to C++0x deduced auto type support:
* Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema
 * Temporary template parameter list for auto deduction is now allocated on the stack.
 * Deduced 'auto' types are now uniqued.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126139 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-21 20:05:19 +00:00
Richard Smith 34b41d939a Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126069 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20 03:19:35 +00:00
Douglas Gregor 5f39f706af Remove the Fix-It for "main must return 'int'", which is not always
correct and is not worth fixing. Fixes PR8396.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 19:04:23 +00:00
Chris Lattner 337e550218 Switch labels over to using normal name lookup, instead of their
own weird little DenseMap.  Hey look, we now emit unused label
warnings deterministically, amazing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 01:27:55 +00:00
Chris Lattner 57ad37823e Step #2/N of __label__ support: keep pushing LabelDecl forward,
making them be template instantiated in a more normal way and 
make them handle attributes like other decls.

This fixes the used/unused label handling stuff, making it use
the same infrastructure as other decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125771 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 20:34:02 +00:00
Chris Lattner ad8dcf4a9d Step #1/N of implementing support for __label__: split labels into
LabelDecl and LabelStmt.  There is a 1-1 correspondence between the
two, but this simplifies a bunch of code by itself.  This is because
labels are the only place where we previously had references to random
other statements, causing grief for AST serialization and other stuff.

This does cause one regression (attr(unused) doesn't silence unused
label warnings) which I'll address next.

This does fix some minor bugs:
1. "The only valid attribute " diagnostic was capitalized.
2. Various diagnostics printed as ''labelname'' instead of 'labelname'
3. This reduces duplication of label checking between functions and blocks.

Review appreciated, particularly for the cindex and template bits.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125733 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 07:39:24 +00:00
Peter Collingbourne e2f82f7138 Reject forbidden storage class specifiers in OpenCL. Patch by George Russell!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125399 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 19:59:54 +00:00
Peter Collingbourne 14b6ba7771 AST, Sema, Serialization: keep track of cudaConfigureCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125216 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 21:04:32 +00:00
Argyrios Kyrtzidis 651f86fb6b In Sema::CheckShadow, get the DeclContext from the variable that we are checking
instead from the Scope; Inner scopes in bodies don't have DeclContexts associated with them.

Fixes http://llvm.org/PR9160 & rdar://problem/8966163.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 18:21:25 +00:00
Fariborz Jahanian 1e52dfc648 Support for objextive-c++ use of property-dot syntax as receiver
in liu of a class method getter. 
// rdar://8962253


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125094 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 18:05:59 +00:00
Argyrios Kyrtzidis 1de34dd8a6 When the out-of-line definition differs from the declaration in the return type,
say "out-of-line definition differ from the declaration in the return type" instead of
the silly "functions that differ only in their return type cannot be overloaded".

Addresses rdar://7980179.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124939 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 05:54:49 +00:00
Douglas Gregor 461bf2eb82 Tweak my fix for PR8748, and update the incorrect PR number in the test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124863 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 12:22:53 +00:00
Douglas Gregor d89d86fe4a Tighten up the semantics of default template arguments, per C++0x
[temp.param]p9 and C++ DR226. Fixes PR8747.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124856 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 04:20:44 +00:00
Argyrios Kyrtzidis 799ef66668 Implement -Woverloaded-virtual.
The difference with gcc is that it warns if you overload virtual methods only if
the method doesn't also override any method. This is to cut down on the number of warnings
and make it more useful like reported here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423.
If we want to warn that not all overloads are overriden we can have an additional
warning like -Wpartial-override.

-Woverloaded-virtual, unlike gcc, is added to -Wmost. Addresses rdar://8757630.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124805 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 18:01:15 +00:00
John McCall cde5a400db The code trying to assign a typedef to an anonymous tag declaration was
extremely rambunctious, both on parsing and on template instantiation.
Calm it down, fixing an internal consistency assert on anonymous enum
instantiation manglings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124653 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 08:20:08 +00:00
Argyrios Kyrtzidis 36eb5e43bc Don't warn that variables in C++ static member functions shadow fields. Fixes rdar://8900456.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 07:04:54 +00:00
Argyrios Kyrtzidis 49a6172798 Fix the diagnostic when we are shadowing an external variable and there exists a locally scoped extern with the same name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124580 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 07:04:50 +00:00
Argyrios Kyrtzidis 6684d85e90 Diagnose if extern local variable is followed by non-extern and vice-versa.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124579 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 07:04:46 +00:00