Commit Graph

26341 Commits

Author SHA1 Message Date
Douglas Gregor 12a6c9e441 Update clang_getCursor() test to check searches on include directives
llvm-svn: 117063
2010-10-21 20:55:34 +00:00
Dan Gohman 2bb62c3d2b Rename clang's TBAA tree root from "experimental" to "simple".
llvm-svn: 117046
2010-10-21 18:50:04 +00:00
Ted Kremenek 5ef9ad9907 Tweak diagnostics for redeclaration of a @property in a class extension where the redelcaration and original
declaration have the 'readwrite' attribute.  This is a common case, and we can issue a more lucid diagnostic.

Fixes <rdar://problem/7629420>.

llvm-svn: 117045
2010-10-21 18:49:42 +00:00
Ted Kremenek 22813f4077 Tidy up comment (remove extraneous text).
llvm-svn: 117044
2010-10-21 18:49:36 +00:00
Dan Gohman 5419ce6827 Add some more comments.
llvm-svn: 117043
2010-10-21 18:49:12 +00:00
Douglas Gregor cd1d0b4f98 Implement the integral promotion rules for the C++0x char16_t and
char32_t character types and enable built-in overloaded operator
candidates for these types. Fixes PR8432.

llvm-svn: 117038
2010-10-21 18:04:08 +00:00
Douglas Gregor a02bb37a8c Diagnose the declaration of template template parameters that
themselves have no template parameters. This is actually a restriction
due to the grammar of template template parameters, but we choose to
diagnose it in Sema to provide better recovery.

llvm-svn: 117032
2010-10-21 17:26:49 +00:00
Douglas Gregor bff6203152 Always treat 'main' as an extern "C" function, so that we detect
redeclarations of main appropriately rather than allowing it to be
overloaded. Also, disallowing declaring main as a template.

Fixes GCC DejaGNU g++.old-deja/g++.other/main1.C.

llvm-svn: 117029
2010-10-21 16:57:46 +00:00
Douglas Gregor 270b2ef0e7 When checking whether a return statement returns a stack-local
variable, handle conditional operators involving a
throw-expression. Fixes GCC DejaGNU's g++.dg/template/cond4.C.

llvm-svn: 117027
2010-10-21 16:21:08 +00:00
Francois Pichet ebdb43d54d Revert r117005, WIN32 is not predefined after all.
llvm-svn: 117026
2010-10-21 16:14:56 +00:00
Ted Kremenek c5644e1b97 Tweak the ObjCAtSyncChecker to assume that a mutex is non-nil after checking that it is
nil.  Otherwise we can get false paths where a second @synchronized using the mutex
can have a bogus warning.  Fixes <rdar://problem/8578650>.

llvm-svn: 117016
2010-10-21 15:38:55 +00:00
Francois Pichet 1ef4eb196d MSVC defines WIN32 as a predefined macro.
llvm-svn: 117005
2010-10-21 09:39:28 +00:00
Michael J. Spencer 54bf3c3cfb Targets: Fix MinGW and VisualStudio predefined macros.
llvm-svn: 117003
2010-10-21 08:22:51 +00:00
Douglas Gregor adfdccf1f3 Improve the implementation of libclang's token-annotation logic for
entities in the preprocessing record. Previously, we would only end up
getting the first token of a preprocessing record annotated
correctly. For example, given

  #include "foo.h"

we would only get the '#' annotated as an inclusion directive; the
'include' and '"foo.h"' tokens would be given the general 'processing
directive' annotation.

Now, we get proper annotations for entities in the preprocessing
record.

llvm-svn: 117001
2010-10-21 06:10:04 +00:00
Michael J. Spencer cac9df3bf6 Add test for Windows predefined macros.
llvm-svn: 117000
2010-10-21 05:23:48 +00:00
Michael J. Spencer 4992ca4b17 Reorganize predefined macros for all Windows targets.
This adds an option to set the _MSC_VER macro without
recompiling. This is very useful when testing compatibility
with the Windows SDK and c++stdlib headers.

-fmsc-version=<version> (defaults to VS2003 (1300))

llvm-svn: 116999
2010-10-21 05:21:48 +00:00
Ted Kremenek 12a37de003 Previously, the printf warnings would say your arguments type was 'int' when it was really a 'char'
or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints.

Patch by Justin Bogner!

llvm-svn: 116996
2010-10-21 04:00:58 +00:00
Ted Kremenek 6377965efb Remove unused variable.
llvm-svn: 116995
2010-10-21 04:00:51 +00:00
Andrew Trick 9642cc6a9d putback r116782, it's a safe fix and should not break windows
llvm-svn: 116994
2010-10-21 03:59:06 +00:00
Michael J. Spencer 4c0ffa823f Fix Whitespace.
llvm-svn: 116990
2010-10-21 03:16:25 +00:00
Michael J. Spencer 7b726c3fc8 Revert "Cleanup and fix predefined macros for windows."
Didn't realize this was on my branch ;/.

llvm-svn: 116989
2010-10-21 03:14:35 +00:00
Michael J. Spencer 2fb548cc05 Cleanup and fix predefined macros for windows.
llvm-svn: 116988
2010-10-21 03:13:04 +00:00
Craig Silverstein af8808dd28 Pass TInfo to CXXDestructorDecl::Create(), just like we do for other
function decls.

Reviewed by rjmccall and nlewycky.

llvm-svn: 116979
2010-10-21 00:44:50 +00:00
Andrew Trick 8cdb3f7d13 revert r116782 & r116793 to fix msvc9 buildbots
llvm-svn: 116976
2010-10-20 23:52:37 +00:00
Argyrios Kyrtzidis 00f5266dbf When implicit members are added to a C++ record, notify the serializer so that a chained PCH writes the definition again.
Thanks to Doug for the hint!

llvm-svn: 116975
2010-10-20 23:48:42 +00:00
Argyrios Kyrtzidis 54b88e72d0 Modify the assumptions of an assert; the updated latest redeclaration can have the same location
if it's a template specialization pointing at the template.

llvm-svn: 116974
2010-10-20 23:48:40 +00:00
Ted Kremenek 982b32b1b6 Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely subsumed by the Checker interface.
llvm-svn: 116973
2010-10-20 23:48:34 +00:00
Ted Kremenek bd2c800882 Convert GRSimpleAPIChecks in BasicObjCFoundationChecks to be Checkers.
llvm-svn: 116971
2010-10-20 23:38:56 +00:00
Douglas Gregor 796d76a663 Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import,
etc. in the translation unit. We keep track of the source location and
kind of the inclusion, how the file name was spelled, and the
underlying file to which the inclusion resolved.

llvm-svn: 116952
2010-10-20 22:00:55 +00:00
Ted Kremenek 983fb5de5f Call clang_disposeTokens() when we are done with the set of tokens.
llvm-svn: 116946
2010-10-20 21:22:15 +00:00
Craig Silverstein 7d8fdef78d Get FunctionDecl to recurse on FunctionTypeLoc rather than
FunctionType!  I didn't realize it was available, until rjmccall
pointed out that DeclaratorDecl made the typeloc available.  This
makes FunctionDecl recursion *much* easier, because the typeloc can
take care of default parameters, so we no longer have to do that
separately, which means we can just do a normal type traversal instead
of this special-case WalkUp stuff we did before.

The only downside -- and it's minor -- is that because the TypeLoc
handles both the return type and the argument types, we can't recurse
on the explicit template args in the right place (which would be
between them).  I do it beforehand instead.  So for
   int MyFunc<float>(char x);
we get callbacks in the order: float, int, char.

Reviewed by chandlerc

llvm-svn: 116945
2010-10-20 21:13:35 +00:00
Argyrios Kyrtzidis 3317d985fe Fix chained PCH issue; make sure all visible decls that will be put into a UPDATE_VISIBLE block were recorded beforehand.
llvm-svn: 116931
2010-10-20 16:22:56 +00:00
Argyrios Kyrtzidis afd639501d Minor optimization; Try to iterator over redeclarations only when necessary.
llvm-svn: 116930
2010-10-20 16:22:49 +00:00
Fariborz Jahanian bb40ea42e3 Fixes a potential crash in rewriter when sending message
to 'super'.

llvm-svn: 116928
2010-10-20 16:07:20 +00:00
Chandler Carruth c7b34694ff Try again to pacify the build bots. =/ I'm getting a Darwin machine to test on.
llvm-svn: 116918
2010-10-20 08:24:03 +00:00
Duncan Sands 3a02f3eeff GCC 4.4 warns that Receiver may be used uninitialized in this function.
As far as I can see, gcc is right to think this!  The following change
will cause a nice segfault rather than undefined behaviour if this case
occurs.  Someone who understands what this code is supposed to do should
probably take a proper look.

llvm-svn: 116917
2010-10-20 08:21:16 +00:00
John McCall f551acaaf5 Access control polish: drop the note on the original declaration and
say 'implicitly' when it was implicit.  Resolves PR 7930 and my peace of mind.

llvm-svn: 116916
2010-10-20 08:15:06 +00:00
Chandler Carruth 4baa6ef5ec Remove a modern bash-ism and use simpler shell redirects. Hopefully will fix
build bots.

llvm-svn: 116914
2010-10-20 07:16:18 +00:00
Chandler Carruth 24e17e175d Add support for the '--sysroot' flag, and an accompanying test of its
interactions with -isysroot and other driver commands.

llvm-svn: 116912
2010-10-20 07:00:47 +00:00
John McCall a020a0159f When matching template parameter lists to template-ids in a scope specifier
on a friend declaration, skip template-ids which do not depend on the
current parameter list.

llvm-svn: 116911
2010-10-20 05:44:58 +00:00
Douglas Gregor d507d77432 Fix handling of property and ivar lookup in typo correction; the two
kinds of lookup into Objective-C classes were tangled together, a
situation that was compounded by automatically synthesized ivars.

llvm-svn: 116907
2010-10-20 03:06:34 +00:00
Anders Carlsson 274a70ed7f Add a __has_attribute macro that works much like __has_feature and __has_builtin.
llvm-svn: 116906
2010-10-20 02:31:43 +00:00
Douglas Gregor 9b2f537f69 Disable this test while I track down the platform-specific issue
llvm-svn: 116904
2010-10-20 01:46:04 +00:00
Douglas Gregor 87074f19e8 Introduce a simple cache for unqualified typo corrections, so that we
don't repeatedly loop through identifiers, correcting the same typo'd
identifier over and over again. 

We still bail out after 20 typo corrections, but this should help
improve performance in the common case where we're typo-correcting
because the user forgot to include a header.

llvm-svn: 116901
2010-10-20 01:32:02 +00:00
Douglas Gregor 30bb275b6b Bah, incompetence
llvm-svn: 116898
2010-10-20 01:16:12 +00:00
Douglas Gregor 1f32ebe892 Eliminate another ordering dependency in typo correction. Re-enable typo.m, which seems to be working properly.
llvm-svn: 116894
2010-10-20 01:01:57 +00:00
Craig Silverstein 3b9936f0b7 Had the wrong type for ArgType. :-( Fixed.
llvm-svn: 116893
2010-10-20 00:56:01 +00:00
Craig Silverstein 20f7ab72b1 The type-to-delete may not be a pointer if it's a dependent type.
Here's example code:
---
template<class T> class MyClass {
  struct S { };
  S* NewS() { return new S; }
  void DeleteS() { delete NewS(); }
};
---
CXXDeleteExpr::getDestroyedType() on the 'delete NewS()' expression
would crash before this change.  Now it returns a dependent type
object.  Solution suggested by dgregor.

llvm-svn: 116891
2010-10-20 00:38:15 +00:00
Bill Wendling 67c5621742 Linux still needs these hacks.
llvm-svn: 116888
2010-10-20 00:12:59 +00:00
Argyrios Kyrtzidis a41f66064f Fix issue with chained PCH where forward references did not pick up later definition in the chained PCH.
llvm-svn: 116887
2010-10-20 00:11:15 +00:00