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

6781 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor b453c53064 Put -Wvla into the -Wgnu warning group
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104606 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 15:04:55 +00:00
Douglas Gregor dc8453422b Improve code completion in failure cases in two ways:
1) Suppress diagnostics as soon as we form the code-completion
  token, so we don't get any error/warning spew from the early
  end-of-file.
  2) If we consume a code-completion token when we weren't expecting
  one, go into a code-completion recovery path that produces the best
  results it can based on the context that the parser is in.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104585 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 05:58:43 +00:00
Zhongxing Xu ab28099e3b CastSizeChecker checks when casting a malloc'ed symbolic region to type T,
whether the size of the symbolic region is a multiple of the size of T.
Fixes PR6123 and PR7217.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 04:59:19 +00:00
Nick Lewycky 45806fe5b8 Make this class useful as a base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104578 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 01:51:06 +00:00
Chris Lattner 6a143ffd46 add a few more categories.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104566 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-24 21:54:02 +00:00
Chris Lattner 9ecb63646a missed an svn add
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104562 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-24 21:38:14 +00:00
Chris Lattner 3f14538ec2 push categories forward a bit more: document them, add some
major buckets to catch parser and sema issues, add inline asm
category, and make diag groups take precedence over the 
sweeping categories just added.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-24 21:35:18 +00:00
Douglas Gregor 94a615718d Downgrade deletion of a void* from an error (which is should be) to an
extension warning (which other compilers seem to use). Works around a
known bug in Xalan.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-24 17:01:56 +00:00
Douglas Gregor a481ec4150 It turns out that people love using VLAs in templates, too. Weaken our
VLA restrictions so that one can use VLAs in templates (even
accidentally), but not as part of a non-type template parameter (which
would be very bad).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 19:57:01 +00:00
Douglas Gregor 9ba6af8bed Complain about sizeof(overloaded function) rather than crashing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104470 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 19:43:23 +00:00
Douglas Gregor 928e6fcf66 Move OverloadExpr over to a ASTContext-allocated pointer for its
storage, rather than an UnresolvedSet. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 19:36:40 +00:00
Douglas Gregor 5a84dec38c Provide the overloaded functions for UnresolvedLookupExpr and
UnresolvedMemberExpr in their constructors, rather than adding them
after the fact. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 18:57:34 +00:00
Douglas Gregor 0054531488 Keep track of all of the class and function template's "common"
pointers in the ASTContext, so that the folding sets stored inside
them will be deallocated when the ASTContext is destroyed (under
-disable-free). <rdar://problem/7998824>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 18:26:36 +00:00
Douglas Gregor db4da82e72 Put the VLA-is-an-extension warning into its own warning group (-Wvla)
so that it can be selectively enabled/disabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104462 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 16:51:27 +00:00
Douglas Gregor 0fddb97901 Implement support for variable length arrays in C++. VLAs are limited
in several important ways:

  - VLAs of non-POD types are not permitted.
  - VLAs cannot be used in conjunction with C++ templates.

These restrictions are intended to keep VLAs out of the parts of the
C++ type system where they cause the most trouble. Fixes PR5678 and
<rdar://problem/8013618>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 16:17:30 +00:00
Chandler Carruth c304ba341a Daniel re-educated me about what Alias does and does not do. Turn that off for
'-fasm' and explicitly map from that flag to -fgnu-keywords in the driver. Turn
off the driver in the lexer test for this madness and add a test to the driver
that the translation actually works.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 02:21:53 +00:00
Daniel Dunbar 3038204fd8 Driver: Add Tool::ShortName, intended to be a human readable name for the tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 00:37:18 +00:00
Douglas Gregor d5ab9b0a0a Improve recovery when we see a dependent template name that is missing
the required "template" keyword, using the same heuristics we do for
dependent template names in member access expressions, e.g.,

test/SemaTemplate/dependent-template-recover.cpp:11:8: error: use 'template'
      keyword to treat 'getAs' as a dependent template name
    T::getAs<U>();
       ^
       template 

Fixes PR5404.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104409 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 23:43:39 +00:00
Fariborz Jahanian 561da7e046 Clang missing warning about conflicting declaration vs. definition
for variable arguments list methods. (radar 8006060).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104407 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 23:28:58 +00:00
Douglas Gregor 1fd6d44d7c Improve parser recovery when we encounter a dependent template name
that is missing the 'template' keyword, e.g., 

  t->getAs<T>()

where getAs is a member of an unknown specialization. C++ requires
that we treat "getAs" as a value, but that would fail to parse since T
is the name of a type. We would then fail at the '>', since a type
cannot be followed by a '>'.

This is a very common error for C++ programmers to make, especially
since GCC occasionally allows it when it shouldn't (as does Visual
C++). So, when we are in this case, we use tentative parsing to see if
the tokens starting at "<" can only be parsed as a template argument
list. If so, we produce a diagnostic with a fix-it that states that
the 'template' keyword is needed:

test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword
      is required to treat 'getAs' as a dependent template name
    t->getAs<T>();
       ^
       template 

This is just a start of this patch; I'd like to apply the same
approach to everywhere that a template-id with dependent template name
can be parsed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 23:18:07 +00:00
Nick Lewycky db3f847cb8 Outdent this file by 2 spaces per the coding standards, and also clean up
whitespace at the end of lines since I'm already touching the whole file
anyways.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104403 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 23:14:51 +00:00
Abramo Bagnara e4aec0eae3 Improved TypeLoc::getSourceRange().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 21:12:12 +00:00
John McCall aec0371e62 Propagate access specifiers to anonymous union members nested within classes.
Fixes <rdar://problem/7987650>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 20:45:30 +00:00
Douglas Gregor e0d5fe2a41 Use CanQualType to enforce the use of a canonical type argument to
CXXBasePaths::isAmbiguous(), rather than just asserting that we have a
canonical type. Fixes PR7176.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 20:29:55 +00:00
Chris Lattner 34d7c4d628 don't make _Bool be a keyword in -fms-extensions mode, patch by
Steven Watanabe!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104373 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 20:22:37 +00:00
Nick Lewycky 74d4031b9a TypeVisitor doesn't visit Stmts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104332 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 18:04:30 +00:00
Chandler Carruth facfc77487 Teach the RecursiveASTVisitor to enter parts of the AST previously missed.
Factor its implementation to ease the addition of these custom edges to
traverse. With this patch we get initializer expressions, block bodies, type
source info, and function argument, result, and exception types. There are
probably still some more missed edges.

While we're here, clean up and flesh out a bunch of comments.

Patch by Zhanyong Wan; I've done a cursory review, but further review
appreciated. This is fast becoming one of the most important public APIs to the
AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104315 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 10:29:57 +00:00
John McCall bc365c5360 Introduce a method to get from an anonymous struct or union record declaration
to the associated object declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104309 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 01:17:40 +00:00
Chris Lattner 63dfd58c14 make -Wc++-hex-floats be a member of -Wc++0x-compat,
thanks to doug for pointing this out!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104297 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 23:43:05 +00:00
Chris Lattner ac0f5e5ed0 Don't warn about use of hex floats in c++ mode by default,
matching G++'s behavior.

Warn when -pedantic or -Wc++-hex-floats is passed, and
don't warn if -pedantic -Wno-c++-hex-floats are both passed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104295 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 23:33:51 +00:00
Douglas Gregor 72a43bbf68 Add a new failure kind, FK_Incomplete, to InitializationSequence, to
capture failures when we try to initialize an incomplete
type. Previously, we would (ab)use FK_ConversionFailed, then
occasionally dereference a null pointer when trying to diagnose the
failure. Fixes <rdar://problem/7959007>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104286 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 22:12:02 +00:00
Daniel Dunbar c673af7fe6 clang -cc1as: Add -help, -version, and -mllvm support.
Also, fix output defaulting to match llvm-mc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104246 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 18:15:20 +00:00
Daniel Dunbar 41b5b17445 Driver/MC: Add 'clang -cc1as' integrated assembler tool, currently accepts approximately the same interface as 'llvm-mc'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104239 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 17:49:16 +00:00
Daniel Dunbar 03e8ab2947 Driver: Move some argument lookup utilities into driver::ArgList.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 16:54:55 +00:00
Abramo Bagnara e03db98d67 Added TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104226 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 15:32:11 +00:00
Abramo Bagnara bd054dba8a Renamed misleading getSourceRange -> getLocalSourceRange and getFullSourceRange -> getSourceRange for TypeLoc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104220 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 10:00:11 +00:00
Ted Kremenek 47e8e399d2 Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104208 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 02:59:19 +00:00
Douglas Gregor 68dd3ee3b5 Various small fixes for construction/destruction of Objective-C++
instance variables:
  - Use isRecordType() rather than isa<RecordType>(), so that we see
  through typedefs in ivar types.
  - Mark the destructor as referenced
  - Perform C++ access control on the destructor


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 02:24:22 +00:00
John McCall ea1471e0e9 Support implicitly closing on 'this' in a block. Fixed PR7165.
(the codegen works here, too, but that's annoying to test without execution)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 01:18:31 +00:00
Chris Lattner 98d279ba80 switch TemplateArgumentListBuilder to hold its flat argument list in a smallvector
instead of new[]'d.  This greatly reduces the number of new[]'s, and guess what, 
they were all leaked.

This adds a fixme in this hunk:

   unsigned NumPackArgs = NumFlatArgs - PackBeginIndex;
+  // FIXME: NumPackArgs shouldn't be negative here???
   if (NumPackArgs)
-    PackArgs = &FlatArgs[PackBeginIndex];
+    PackArgs = FlatArgs.data()+PackBeginIndex;

where test/SemaTemplate/variadic-class-template-2.cpp is accessing the vector
out of range and NumPackArgs is negative.  I assume variadic template args are
completely hosed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104194 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 00:25:36 +00:00
Chris Lattner 885989109a fix the TemplateArgumentList copy constructor to not
be a copy constructor (since it isn't one semantically)
and fix the ownership bits it sets to be correct!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104192 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 00:19:09 +00:00
Chris Lattner 56ef550c5e Clarify TemplateArgumentList ownership over its "flat" and
"structure" arg lists, the first step to fixing some massive
memory leaks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 00:11:47 +00:00
Ted Kremenek 50aa6acd0b Move CXCursor_FirstDecl definition later to make the results more readable in the debugger.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 21:51:10 +00:00
Abramo Bagnara e4da7a034a Added basic source locations to Elaborated and DependentName types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104169 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 21:37:53 +00:00
Fariborz Jahanian 2390a72a3e Adds support for ObjC++'s GC attribute on declaration of
object variables and functions returning such objects.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104168 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 21:37:30 +00:00
Douglas Gregor 60e7064d78 Cache the linkage of a type within its canonical type, eliminating
some seriously non-linear performance with deeply nested template
instantiations, as shown in PR6998.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 18:39:18 +00:00
Ted Kremenek 2bb106eeba Remove clang_isDeclarationADefinition() since its functionality is already provided by clang_isCursorDefinition().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 18:36:55 +00:00
Ted Kremenek 857e918a8a Add clang support for IBOutletCollection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 17:38:06 +00:00
Ted Kremenek b12903e1a4 Add function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguish between
forward declarations and definitions of structs/classes/enums.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:32:15 +00:00
Douglas Gregor f813a2c03f Add support for Microsoft's __thiscall, from Steven Watanabe!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 16:57:00 +00:00