Commit Graph

25515 Commits

Author SHA1 Message Date
Zhanyong Wan abb6d6d618 Make RecursiveASTVisitor not crash when a TemplateArgumentLoc object has a NULL TypeSourceInfo*. This fixes the symptom of http://llvm.org/PR8043. Reviewed by csilvers.
llvm-svn: 112777
2010-09-01 23:54:22 +00:00
Bill Wendling da08c3824b Add some MMX builtins to correspond with the intrinsics now accepted by
LLVM. This will be used by the mmintrin.h header, but that bit still needs to be
worked out.

llvm-svn: 112776
2010-09-01 23:54:16 +00:00
Ted Kremenek f3a734d8ee Add yet another test case for PR 8015, showing how reasoning over symbolic indices should exactly resolve over multiple index possibilities (and thus suppress the false positive in the test).
llvm-svn: 112770
2010-09-01 23:37:38 +00:00
Ted Kremenek 121ddd6a5c Add another test case for PR 8015, here with the array index being within a valid range and not just a single constant.
llvm-svn: 112769
2010-09-01 23:37:36 +00:00
Ted Kremenek 0e12f9cc7b Partial fix for PR 8015 (fix is actually by Jordy Rose, and I added a test case for follow-on work). This patch adds a bandaid for RegionStore's limited reasoning about symbolic array values.
llvm-svn: 112766
2010-09-01 23:27:26 +00:00
Bob Wilson 1b87c9a646 Translate NEON vmull, vmlal, and vmlsl builtins to llvm multiply-add/sub
with zext/sext operations, instead of to llvm intrinsics.  I have a plan to
avoid the clang builtins for these, but it is going to take a little longer
and I want to get the NEON intrinsics updated before the 2.8 release.

llvm-svn: 112764
2010-09-01 23:20:27 +00:00
Craig Silverstein 50391ba195 Update the docstring to say FriendTemplateDecl is not actually used.
Based on discussion with rjmccall and dgregor.

llvm-svn: 112762
2010-09-01 23:07:49 +00:00
Ted Kremenek d588e78b95 Don't assert in the analyzer when analyze code does a byte load from a function's address. Fixes PR 8052.
llvm-svn: 112761
2010-09-01 23:00:46 +00:00
Craig Silverstein 0eaac04e47 Make some docstring clarifications, after discussion with dgregor.
llvm-svn: 112759
2010-09-01 22:55:38 +00:00
Douglas Gregor be99693127 Fix the source-range information for an EnumConstantDecl; previously,
it did not include the initializer expression.

llvm-svn: 112739
2010-09-01 20:41:53 +00:00
Ted Kremenek 026cb58a44 Don't assert in CastSizeChecker when the casted-to pointee is an incomplete type. Fixes PR 8050.
llvm-svn: 112738
2010-09-01 20:35:38 +00:00
Douglas Gregor 982152433b Test visiting the template parameters of template template parameters,
support for which came in with the last commit.

llvm-svn: 112735
2010-09-01 20:21:58 +00:00
Douglas Gregor 06c7d2df9b Teach libclang to visit the default arguments of template parameters.
llvm-svn: 112734
2010-09-01 20:16:53 +00:00
Douglas Gregor a9aa29cf0b Implement libclang support for using declarations. Clang actually uses
three different kinds of AST nodes to represent using declarations:
UsingDecl, UnresolvedUsingValueDecl, and
UnresolvedUsingTypenameDecl. These three are collapsed into a single
cursor kind for using declarations, since libclang clients don't need
the distinction.

Several related changes here:
  - Cursor visitation of the three AST nodes for using declarations
  - Proper source-range computation for these AST nodes
  - Using declarations have no USRs, since they don't actually declare
    any entities.

llvm-svn: 112730
2010-09-01 19:52:22 +00:00
Fariborz Jahanian 61a312413c Fix IRGen when property-dot syntax used to access
a c++ class object 'ivar'. Fixes radar 8366604.

llvm-svn: 112729
2010-09-01 19:36:41 +00:00
Douglas Gregor 9dc243c3eb Improve libclang indexing support for class template specializations
in a few related ways:

  - Don't recurse into instantiations of templates.
  - Recurse into explicit specializations.
  - Visit the template arguments of an explicit specialization or
    explicit instantiation.
  - Include template specialization arguments in the USRs for class
    template specializations.

llvm-svn: 112720
2010-09-01 17:32:36 +00:00
Benjamin Kramer 2bd4cee516 StringRefize.
llvm-svn: 112718
2010-09-01 17:28:48 +00:00
Douglas Gregor 57879faf91 Make it clear that libclang does not modify the command-line arguments
it is given.

llvm-svn: 112717
2010-09-01 16:43:19 +00:00
Douglas Gregor 920cadf9ae Add test for nothing... i.e., the contents of a USR for using directives
llvm-svn: 112716
2010-09-01 16:37:17 +00:00
Douglas Gregor eece0eaa85 Transfer calling-convention attributes down to member function pointers.
llvm-svn: 112715
2010-09-01 16:29:03 +00:00
Chris Lattner 988fd16060 add a new version of mingw, patch by İsmail "cartman" Dönmez
in PR8049

llvm-svn: 112710
2010-09-01 15:51:58 +00:00
Chris Lattner 0073962025 when emitting an error about a missing } in a compound statement, emit
a "to match this {" note, pointing out the opener.

llvm-svn: 112709
2010-09-01 15:49:26 +00:00
Douglas Gregor 01a430134f Implement libclang support for using directives (cursor + visitation +
suppressing USRs). Also, fix up the source location information for
using directives so that the declaration location refers to the
namespace name.

llvm-svn: 112693
2010-09-01 03:07:18 +00:00
Ted Kremenek 0ef508d301 Split ObjCInterfaceDecl::ReferencedProtocols into two lists: ReferencedProtocols and AllReferencedProtocols. ReferencedProtocols
(and thus protocol_begin(), protocol_end()) now only contains the list of protocols that were directly referenced in
an @interface declaration.  'all_referenced_protocol_[begin,end]()' now returns the set of protocols that were referenced
in both the @interface and class extensions.  The latter is needed for semantic analysis/codegen, while the former is
needed to maintain the lexical information of the original source.

Fixes <rdar://problem/8380046>.

llvm-svn: 112691
2010-09-01 01:21:15 +00:00
Chris Lattner d426c8eae3 fix rdar://8360877 a really nasty miscompilation in Boost.Xpressive
caused by my ABI work.  Passing:

struct outer {
  int x;
  struct epsilon_matcher {} e;
  int f;
};

as {i32,i32} isn't safe, because the offset of the second element
needs to be at 8 when it is interpreted as a memory value.

llvm-svn: 112686
2010-09-01 00:50:20 +00:00
Chris Lattner be5eb17536 same refactoring as before, this time on the argument side.
llvm-svn: 112684
2010-09-01 00:24:35 +00:00
Chris Lattner 52b3c13149 refactor some code to cut down on redundancy, no functionality change.
llvm-svn: 112683
2010-09-01 00:20:33 +00:00
Douglas Gregor f9e43cef54 Improve location information in the representation of namespace
aliases. Previously, the location of the alias was at the "namespace"
keyword. Now, it's on the identifier being declared (as is the custom
for Clang), and we keep a separate source location for the "namespace"
keyword.

Also, added a getSourceRange() member function to NamespaceAliasDecl
to correctly compute the source range.

Finally, removed a bunch of setters from NamespaceAliasDecl and gave
ASTReaderDecl friendship so that it could set the corresponding fields
directly.

llvm-svn: 112681
2010-09-01 00:08:19 +00:00
Fariborz Jahanian 39de024e66 Prevent warning when built with assert off.
llvm-svn: 112680
2010-08-31 23:54:38 +00:00
Fariborz Jahanian eb5a307259 xcode project file update.
llvm-svn: 112677
2010-08-31 23:49:56 +00:00
Douglas Gregor a89314e396 Add libclang support for namespace aliases (visitation + USRs) along
with a new cursor kind for a reference to a namespace. 

There's still some oddities in the source location information for
NamespaceAliasDecl that I'll address with a separate commit, so the
source locations displayed in the load-namespaces.cpp test will
change.

llvm-svn: 112676
2010-08-31 23:48:11 +00:00
Fariborz Jahanian abaae2b692 Some support for unicode string constants
in wide strings. radar 8360841.

llvm-svn: 112672
2010-08-31 23:34:27 +00:00
Sebastian Redl a93bb5b807 Implement __has_feature(cxx_inline_namespaces)
llvm-svn: 112671
2010-08-31 23:28:47 +00:00
Anton Korobeynikov 1b80c2aaee Add NetBSD include search path
llvm-svn: 112663
2010-08-31 22:39:50 +00:00
John McCall c265ad253e Add convenience accessors for determining whether template declarations are definitions.
llvm-svn: 112656
2010-08-31 22:21:26 +00:00
Douglas Gregor f11309e194 Add a new libclang function clang_getTemplateCursorKind(), which
determines the kind of declaration that would be generated if the
given template were instantiated. This allows a client to distinguish
among class/struct/union templates and function/member function/static
member function templates.

Also, teach clang_CXXMethod_isStatic() about function templates.

llvm-svn: 112655
2010-08-31 22:12:17 +00:00
John McCall c134eb5ada Amusingly, I missed this point of abstraction in all my earlier
member-pointer refactoring:  dereferencing a member data pointer.

llvm-svn: 112640
2010-08-31 21:07:20 +00:00
Sebastian Redl bd59576541 Make inline namespace not be transparent after all. The concept simply doesn't fit. Instead, special-case the few places where transparent contexts have the desired behavior for inline namespaces. Fixes a redeclaration issue in inline namespaces.
llvm-svn: 112637
2010-08-31 20:53:31 +00:00
Douglas Gregor a23e8f7a0f Extend libclang with a new cursor kind that indicates a reference to a
template. Such cursors occur, for example, in template specialization
types such as vector<int>. Note that we do not handle the
super-interesting case where the template name is unresolved, e.g.,
within a template.

llvm-svn: 112636
2010-08-31 20:37:03 +00:00
Douglas Gregor f96abb293a Add libclang support for class template partial specializations,
including a cursor kind, visitation, and USRs.

llvm-svn: 112629
2010-08-31 19:31:58 +00:00
Douglas Gregor 1fbaeb196b Add a libclang cursor kind, visitation support and USR support for C++
class templates. 

llvm-svn: 112627
2010-08-31 19:02:00 +00:00
Ted Kremenek 0f5d8bc5fc Improve CFG printing support for CXXOperatorCallExpr and CXXBindTemporaryExpr.
llvm-svn: 112619
2010-08-31 18:47:37 +00:00
Ted Kremenek 128d04dfe8 Explicitly handle CXXOperatorCallExpr when building CFGs. We should treat it the same as CallExprs.
Fixes: <rdar://problem/8375510> [Boost] CFGBuilder crash in Boost.Graph
llvm-svn: 112618
2010-08-31 18:47:34 +00:00
Fariborz Jahanian c6bf0bd51b AST work to support [C++] [IRgen] for ?: with missing LHS
This is also pr7726 and wip. No change in functionality
at this time.

llvm-svn: 112612
2010-08-31 18:02:20 +00:00
Douglas Gregor 713602bb09 Implement basic support for indexing function templates in
libclang. This includes:
  - Cursor kind for function templates, with visitation logic
  - Cursor kinds for template parameters, with visitation logic
  - Visitation logic for template specialization types, qualified type
  locations
  - USR generation for function templates, template specialization
  types, template parameter types.

Also happens to fix PR7804, which I tripped across while testing.

llvm-svn: 112604
2010-08-31 17:01:39 +00:00
Chris Lattner 04dc957260 Add support for windows x86-64 varargs, patch by Cameron Esfahani!
llvm-svn: 112603
2010-08-31 16:44:54 +00:00
Chris Lattner 0f0492e69c improve isHexaLiteral to work with escaped newlines and trigraphs,
patch by Francois Pichet!

llvm-svn: 112602
2010-08-31 16:42:00 +00:00
Douglas Gregor 12bca22e91 libclang indexing support for C++ constructors, destructors, and
conversion functions. This introduces new cursor kinds for these three
C++ entities, and reworks visitation of function declarations so that
we get type-source information for the names.

llvm-svn: 112600
2010-08-31 14:41:23 +00:00
Douglas Gregor db2be6a592 Add a simple test for indexing namespaces
llvm-svn: 112598
2010-08-31 13:31:19 +00:00
John McCall 5d865c3292 Teach IR generation to return 'this' from constructors and destructors
under the ARM ABI.

llvm-svn: 112588
2010-08-31 07:33:07 +00:00
Chandler Carruth fc0e2a03fa Fix a regression that allowed clearly ill formed code. The diagnostic is still
terrible, FIXME left to do a proper job of diagnosing this.

llvm-svn: 112581
2010-08-31 05:42:40 +00:00
Douglas Gregor 79a2788512 Revert my lame attempt at appeasing the CFGBuilder
llvm-svn: 112580
2010-08-31 05:36:56 +00:00
Douglas Gregor 400f59763b When provide code completions for a variadic Objective-C method
declaration send or a variadic function call, collapse the ", ..."
into the parameter before it, so that we don't get a second
placeholder.

llvm-svn: 112579
2010-08-31 05:13:43 +00:00
Douglas Gregor f5d453d067 Teach the CFGBuilder not do die on CXXBindTemporaryExpr, CXXOperatorCallExpr. Fixes a Boost.Graph crasher.
llvm-svn: 112578
2010-08-31 05:10:27 +00:00
Sebastian Redl 7dcb155c18 Implement the __has_nothrow trait family, by Steven Watanabe.
llvm-svn: 112577
2010-08-31 04:59:00 +00:00
Ted Kremenek b8691e6081 Add range of return value expression in ReturnUndefChecker. Patch by Jim Goodnow II!
llvm-svn: 112569
2010-08-31 01:35:32 +00:00
Sebastian Redl 5a5f2c76b6 Enable inline namespaces in C++03 as an extension.
llvm-svn: 112566
2010-08-31 00:36:45 +00:00
Sebastian Redl 35034569c7 Add a forgotten place where the enclosing namespace set matters, plus a big testcase for inline namespace fun.
llvm-svn: 112565
2010-08-31 00:36:40 +00:00
Sebastian Redl b5c2baa2d7 Enable inline namespaces in the AST.
llvm-svn: 112564
2010-08-31 00:36:36 +00:00
Sebastian Redl 50c682585f Rename DeclContext::getLookupContext to getRedeclContext and change its semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them.
llvm-svn: 112563
2010-08-31 00:36:30 +00:00
Sebastian Redl 4f08c96a8b Decl::getEnclosingNamespaceContext has no reason to explicitly skip transparent contexts, and would be wrong to do so with inline namespaces.
llvm-svn: 112562
2010-08-31 00:36:23 +00:00
Douglas Gregor 4afc236cee When instantiating a function type, instantiate the return type before
instantiating the parameters. In a perfect world, this wouldn't
matter, and compilers are free to instantiate in any order they
want. However, every other compiler seems to instantiate the return
type first, and some code (in this case, Boost.Polygon) depends on
this and SFINAE to avoid instantiating something that shouldn't be
instantiated.

We could fight this battle, and insist that Clang is allowed to do
what it does, but it's not beneficial: it's more predictable to
instantiate this way, in source order. When we implement
late-specified return types, we'll need to instantiate the return type
last when it was late-specified, hence the FIXME.

We now compile Boost.Polygon properly.

llvm-svn: 112561
2010-08-31 00:26:14 +00:00
Douglas Gregor 4d13d10df2 Add a missing return. Bug noticed by Dawn Perchik!
llvm-svn: 112552
2010-08-30 23:30:49 +00:00
Douglas Gregor a477e2afe7 When template substitution into a template parameter reduces the level
of that parameter, reduce the level by the number of active template
argument lists rather than by 1. The number of active template
argument lists is only > 1 when we have a class template partial
specialization of a member template of a class template that itself is
a member template of another class template. 

... and Boost.MSM does this. Fixes PR7669.

llvm-svn: 112551
2010-08-30 23:23:59 +00:00
Chris Lattner dec7334218 silence a warning
llvm-svn: 112549
2010-08-30 23:11:03 +00:00
Gabor Greif 1286617c64 zap tabs
llvm-svn: 112541
2010-08-30 22:25:56 +00:00
Chris Lattner a48fbe8c53 Fix PR8029, a x86-32 ABI regression in introduced in r112211
llvm-svn: 112537
2010-08-30 22:03:23 +00:00
Gabor Greif 3fe617cc09 add two more use-cases (explicit instantiation) that should pass now
llvm-svn: 112533
2010-08-30 21:45:06 +00:00
Gabor Greif 718d515b3a fix dual aspect of PR8007,
namely when the friend function prototype is already used
at the point of the template definition that is supposed
to inject the friend function. Testcase verifies four
scenarios.
I would like receive some code review for this.

llvm-svn: 112524
2010-08-30 21:10:05 +00:00
Douglas Gregor 66d2c8e886 Perform the function-to-pointer adjustment during template argument
deduction where the parameter is a function reference, function
pointer, or member function pointer and the argument is an overloaded
function. Fixes <rdar://problem/8360106>, a template argument
deduction issue found by Boost.Filesystem.

llvm-svn: 112523
2010-08-30 21:04:23 +00:00
Bob Wilson b9225f7f85 Translate NEON vmovn builtin to a vector truncation instead of using an llvm
intrinsic.

llvm-svn: 112504
2010-08-30 19:57:13 +00:00
Tom Care 9026d4b488 Adjusted the semantics of assign checking in IdempotentOperationChecker
- Fixed a regression where assigning '0' would be reported
- Changed the way self assignments are filtered to allow constant testing
- Added a test case for assign ops
- Fixed one test case where a function pointer was not considered constant
- Fixed test cases relating to 0 assignment

llvm-svn: 112501
2010-08-30 19:25:43 +00:00
Alexis Hunt 3b7918625c Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

llvm-svn: 112493
2010-08-30 17:47:05 +00:00
Chris Lattner 5f183aa592 add a fixme.
llvm-svn: 112491
2010-08-30 17:11:14 +00:00
Chris Lattner 7a9e9e7d76 use 'features' instead of 'PP->getLangOptions'.
llvm-svn: 112490
2010-08-30 17:09:08 +00:00
Douglas Gregor 561eceb4c4 Heap-allocate the attribute vectors in
ASTContext::DeclAttrs. Otherwise, iterators will go stale when the
DenseMap reallocates, which can cause crashes when, e.g., looping over
the attributes in a template to instantiate them and add the results
to the instantiation of that template.

llvm-svn: 112488
2010-08-30 16:49:28 +00:00
Douglas Gregor 1262b0636e Fix an corner-case assertion introduced by the refactoring in r112258;
when we're taking the address of a unresolvable value, it might be an
implicit member access. Fixes some Boost.Spirit regressions.

llvm-svn: 112487
2010-08-30 16:00:47 +00:00
Douglas Gregor 3cc2648b47 Now that GCC will have #pragma push/pop (in GCC 4.6), allow the
#pragma without requiring it to be in the "clang" namespace, from
Louis Gerbarg!

llvm-svn: 112484
2010-08-30 15:15:34 +00:00
Douglas Gregor f62c5294c1 Emulate (some of) Microsoft's looser semantic checking of exception
specifications, from Martin Vejnar!

llvm-svn: 112482
2010-08-30 15:04:51 +00:00
Douglas Gregor 759ef23bb8 In Microsoft compatibility mode, don't parse the exponent as part of
the pp-number in a hexadecimal floating point literal, from Francois
Pichet! Fixes PR7968.

llvm-svn: 112481
2010-08-30 14:50:47 +00:00
Douglas Gregor 2b1bbecb6b Predeclare class type_info in Microsoft mode, from Francois Pichet!
llvm-svn: 112478
2010-08-30 14:44:26 +00:00
Douglas Gregor cfcb942267 Add test case from PR6952, which now works (thanks to Gabor).
llvm-svn: 112477
2010-08-30 14:37:53 +00:00
Douglas Gregor 2c7d9290ee Add redeclaration checking for static data members and fix a corner
case with redeclaration checking for fields, from Faisal Vali!
Fixes PR7970.

llvm-svn: 112476
2010-08-30 14:32:14 +00:00
Douglas Gregor 5209a0d850 Fix CMake dependencies
llvm-svn: 112475
2010-08-30 14:31:03 +00:00
Duncan Sands f610b5b622 Straighten out target triples provided on the command line
before using them.

llvm-svn: 112468
2010-08-30 09:42:39 +00:00
Alexis Hunt e3675ef0f3 Two minor fixes to user-defined literals:
- Zero-initialize UDLData so that crashes stop
 - Stop complaining that we can't emit them (we most certainly can)

llvm-svn: 112467
2010-08-30 09:27:16 +00:00
Chandler Carruth 9ed87ba797 Add some braces for sanity and GCC silence. These became unbalanced in r112122,
so please review echristo and let me know if the logic is wrong now.

llvm-svn: 112466
2010-08-30 07:36:24 +00:00
Alexis Hunt 8591e9e06f Fix some test-breaking that snuck into my previous commit
llvm-svn: 112460
2010-08-29 22:39:32 +00:00
Alexis Hunt 79eb5469e0 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

llvm-svn: 112458
2010-08-29 21:26:48 +00:00
Douglas Gregor 981a0c4613 When providing a code completion for an Objective-C message send, drop
the parameter names from the completions, e.g., provide

  withString:(NSString *)

instead of

  withString:(NSString *)string

since the parameter name is, by convention, redundant with the
selector piece that precedes it and the completions can get
unnecessarily long.

llvm-svn: 112456
2010-08-29 19:47:46 +00:00
Douglas Gregor 99129efdd3 Improve code completion for initializer lists in constructors. Instead
of prioritizing just by initialization order, we bump the priority of
just the *next* initializer in the list, and leave everything else at
the normal priority. That way, if one intentionally skips the
initialization of a base or member (to get default initialization),
we'll still get ordered completion for the rest.

llvm-svn: 112454
2010-08-29 19:27:27 +00:00
Douglas Gregor fdce48b0ca Add missing test case for constructor-initializer code completions
llvm-svn: 112453
2010-08-29 19:20:21 +00:00
Fariborz Jahanian 161848a030 ObjClang++: Allow declaration of block variable in a collection
statement header (fixes radar 8295106).

llvm-svn: 112443
2010-08-29 17:20:53 +00:00
Zhongxing Xu b0a6de9e8f Add comments.
llvm-svn: 112414
2010-08-29 05:16:31 +00:00
Bob Wilson 0e7a398936 Translate NEON vaddl, vaddw, vsubl, and vsubw builtins to llvm add/sub
with zext/sext operations, instead of to llvm intrinsics.  (We can also
get rid of the clang builtins and handle these entirely in the arm_neon.h
header if there is a way to express vector sext/zext in C.)

llvm-svn: 112413
2010-08-29 05:14:28 +00:00
John McCall 49039d4afb Complain if a __pragma isn't terminated.
llvm-svn: 112392
2010-08-29 01:09:54 +00:00
John McCall 89e925d78e Add support for Microsoft's __pragma in the preprocessor.
Patch by Francois Pichet!

llvm-svn: 112391
2010-08-28 22:34:47 +00:00
John McCall 0856906b1e When perform exact-qualifier-match template argument deduction,
properly account for the possibility that certain opaque types
might be more qualified than they appear.  Fixes PR7708.

llvm-svn: 112390
2010-08-28 22:14:41 +00:00
John McCall fb3f9ba969 If filtering a lookup result leaves it ambiguous, keep the ambiguity
kind.  Fixes PR7252.

llvm-svn: 112383
2010-08-28 20:17:00 +00:00
Ted Kremenek 52ac860d9c Delete the relaxedLiveness object in the dtor of AnalysisContext.
llvm-svn: 112380
2010-08-28 18:59:04 +00:00
Chris Lattner 0e7c68da96 improve comment, patch by Vladimir Kirillov!
llvm-svn: 112374
2010-08-28 16:26:18 +00:00
Gabor Greif ae849e4407 simplify by relying on cascading operator->
llvm-svn: 112373
2010-08-28 15:46:56 +00:00
Gabor Greif 122f1eb2b8 simplify
llvm-svn: 112372
2010-08-28 15:42:30 +00:00
Nick Lewycky 4a9da315d3 Fix copy+paste error in comment.
llvm-svn: 112370
2010-08-28 13:52:51 +00:00
Gabor Greif b0c557be1e add another test for PR8007
this is still failing, need to come up with a fix
(but we are in good company as the first gcc version
 pass this test will be v4.6)

llvm-svn: 112369
2010-08-28 12:12:45 +00:00
Gabor Greif 156315b7d8 the target of the link uses the singular form, so do we too
llvm-svn: 112367
2010-08-28 11:05:27 +00:00
Gabor Greif e27ea5c92e typo
llvm-svn: 112366
2010-08-28 11:03:06 +00:00
Gabor Greif e6523ea915 suppress annoying textual repetition as 'aka'
llvm-svn: 112365
2010-08-28 10:40:52 +00:00
Argyrios Kyrtzidis 43b205796f Fix the memory leak of FloatingLiteral/IntegerLiteral.
For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers.
Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
the APFloat/APInt values will never get freed.
I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral.

Fixes rdar://7637185

llvm-svn: 112361
2010-08-28 09:06:06 +00:00
John McCall 1177ff1740 That's not the right direction to compute notional accessibility in at all.
llvm-svn: 112360
2010-08-28 08:47:21 +00:00
John McCall c6af8f4689 Fix build. Bad me, adding last-minute assertions.
llvm-svn: 112359
2010-08-28 08:10:32 +00:00
John McCall 96329678e4 When checking access control for an instance member access on
an object of type I, if the current access target is protected
when named in a class N, consider the friends of the classes P
where I <= P <= N and where a notional member of N would be
non-forbidden in P.

llvm-svn: 112358
2010-08-28 07:56:00 +00:00
Gabor Greif 468aa3b20c check whether sema issues a redefinition error
llvm-svn: 112347
2010-08-28 02:00:22 +00:00
Gabor Greif 34ecff269e perform cheap test first
llvm-svn: 112346
2010-08-28 01:58:12 +00:00
Nick Lewycky 02d13d1356 Ignore this flag too, Clang doesn't seem to use random numbers internally.
llvm-svn: 112342
2010-08-28 01:01:21 +00:00
Gabor Greif 73ddbc51ab note to self: save before committing; add PR
llvm-svn: 112339
2010-08-28 00:48:36 +00:00
Gabor Greif 1d28820888 fix test by applying it in top namespace: PR8007 only showed up this way
llvm-svn: 112338
2010-08-28 00:45:56 +00:00
Ted Kremenek d7478d6010 Update test case, with comment to later investigate the correct behavior. Now the behavior is at least consistent.
llvm-svn: 112335
2010-08-28 00:19:12 +00:00
Ted Kremenek 82bfc86792 Explicitly handle CXXExprWithTemporaries during CFG construction by just visiting the subexpression. While we don't do anything intelligent right now, this obviates a bogus -Wunreahable-code warning reported in PR 6130.
llvm-svn: 112334
2010-08-28 00:19:02 +00:00
Gabor Greif b6aba3ef28 fix PR8007
reordering and redefinition issues still may linger,
I plan to nail them next

llvm-svn: 112333
2010-08-28 00:16:06 +00:00
Douglas Gregor eaeeca9afe Basic code completion support for the base and member initializers in
a constructor.

llvm-svn: 112330
2010-08-28 00:00:50 +00:00
Gabor Greif a56984c72f reproduction recipe for PR8007, expected to fail for now, review welcome
llvm-svn: 112326
2010-08-27 23:39:49 +00:00
Sebastian Redl 6766794c0b Parser support for inline namespaces
llvm-svn: 112320
2010-08-27 23:12:46 +00:00
Sebastian Redl 5bfe034ecc Comment and move another ASTReader member.
llvm-svn: 112319
2010-08-27 23:12:39 +00:00
Sebastian Redl cc6458890d Update comment after Chandler's change.
llvm-svn: 112318
2010-08-27 23:12:36 +00:00
Douglas Gregor fcee9460c6 Miscellaneous found by inspection with John and Sebastian
llvm-svn: 112315
2010-08-27 22:55:10 +00:00
Tom Care 71cc9d886a Added checking of (x == x) and (x != x) to IdempotentOperationChecker and updated test cases flagged by it.
llvm-svn: 112313
2010-08-27 22:50:47 +00:00
Tom Care 98e679508d Enabled relaxed LiveVariables analysis in the path-sensitive engine to increase the coverage of bugs. Primarily affects IdempotentOperationChecker.
- Migrated a temporarily separated test back to its original file (bug has been fixed, null-deref-ps-temp.c -> null-deref-ps.c)
- Changed SymbolManager to use relaxed LiveVariables
- Updated several test cases that the IdempotentOperationChecker class now flags
- Added test case to test relaxed LiveVariables use by the IdempotentOperationChecker

llvm-svn: 112312
2010-08-27 22:46:32 +00:00
Tom Care f7b7067c4d Remove an assertion in UnreachableCodeChecker that can be triggered by bugs in other checkers.
llvm-svn: 112310
2010-08-27 22:37:31 +00:00
Tom Care c29c91aaaa Fix bug in IdempotentOperationChecker where an assumption would not get updated properly.
llvm-svn: 112309
2010-08-27 22:35:28 +00:00
Chris Lattner 1ba644575d handle :: in selectors in objc++ mode, rdar://8366474
llvm-svn: 112307
2010-08-27 22:32:41 +00:00
Tom Care e5aa30c722 Add alternate version of LiveVariables analysis that does not kill liveness at assignments. This 'relaxed' liveness is useful in path sensitive analysis for situations where the resulting extended liveness allows us to find some bugs.
- Added killAtAssign flag to LiveVariables
- Added relaxed LiveVariables to AnalysisContext with an accessor

llvm-svn: 112306
2010-08-27 22:30:10 +00:00
Ted Kremenek 378e93c210 Add source file I meant to include in my previous commit.
llvm-svn: 112303
2010-08-27 21:57:20 +00:00
Douglas Gregor 7bddb3cac3 Improve wording of diagnostic complaining about a non-void* pointer as the first parameter of operator delete
llvm-svn: 112298
2010-08-27 21:39:15 +00:00
Ted Kremenek ae9e221513 Implement CXCursor support for walking C++ base specifiers. This includes adding the API hooks clang_isVirtualBase() and clang_getCXXAccessSpecifier() to query properties of the base specifier.
Implements <rdar://problem/8274883>.

llvm-svn: 112296
2010-08-27 21:34:58 +00:00
Ted Kremenek 2c2c5f3789 Fix copy-paste in doxygen comment.
llvm-svn: 112295
2010-08-27 21:34:51 +00:00
Douglas Gregor ac322ec9b9 Implement the "call super" code completion for C++. If the virtual
member function you're typing in overrides another virtual function,
this fills in a (qualified!) call to that virtual function to make
such delegation easy.

llvm-svn: 112294
2010-08-27 21:18:54 +00:00
Douglas Gregor 9704c75b1f Teach clang_codeComplete to always sort its code-completion results
llvm-svn: 112292
2010-08-27 21:13:41 +00:00
Chris Lattner 212a492063 fix incorrect MM_HINT_ definitions, PR8011
llvm-svn: 112283
2010-08-27 20:10:06 +00:00
John McCall 1ababa63de Continue to instantiate sub-statements in a CompoundStmt as long as
we don't see a DeclStmt (failure to instantiate which generally causes
panic).

llvm-svn: 112282
2010-08-27 19:56:05 +00:00
Devang Patel 96b7f55a03 Debug info for friends!
Patch originally by Alexander Herz.

llvm-svn: 112275
2010-08-27 17:47:47 +00:00
Douglas Gregor 28c7843ec4 Suggest "const" and "volatile" code completions after a function
declarator, the very definition of "low-hanging fruit".

llvm-svn: 112274
2010-08-27 17:35:51 +00:00
Bob Wilson 7b0d032d0c Add the new alignment arguments for NEON load/store intrinsics, based on the
types of the pointer address expressions used with those intrinsics.

llvm-svn: 112272
2010-08-27 17:14:29 +00:00
Dan Gohman 8b4c320778 createMainFileID doesn't need its IncludePos argument, since
the main file isn't an included file, and the IncludePos is
always SourceLocation().

llvm-svn: 112269
2010-08-27 15:44:11 +00:00
Douglas Gregor c2cb2e23bc When code-completing inside an Objective-C method, give a slight
priority boost to methods with the same selector. 

llvm-svn: 112268
2010-08-27 15:29:55 +00:00
Douglas Gregor 6fc0413e59 Add a super-cool code completion for send-to-super. When we're typing
a message send to "super" from a method that appears to be meant to
override a superclass method (same kind, same selector, same argument
types), provide a "super" completion that fills in the selector along
with forwarding the method's arguments (as placeholders).

llvm-svn: 112263
2010-08-27 15:10:57 +00:00
Douglas Gregor f0b38ebb53 Fix CMake dependencies, from Fernando Pelliccioni!
llvm-svn: 112261
2010-08-27 14:18:05 +00:00
John McCall 8d08b9b408 Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic
form.

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a        
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.

llvm-svn: 112258
2010-08-27 09:08:28 +00:00
Douglas Gregor f5bae22db7 Don't recurse twice when we can recurse once
llvm-svn: 112246
2010-08-27 00:11:28 +00:00
John McCall faf5fb4b78 One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.

llvm-svn: 112244
2010-08-26 23:41:50 +00:00
Devang Patel b0958c7699 test case for r112238.
llvm-svn: 112239
2010-08-26 22:54:33 +00:00
Ted Kremenek 036223bdcf Fix horrible GRExprEngine bug where switch statements with no 'case:' statements would cause the path to get prematurely aborted. Fixes <rdar://problem/8360854>.
llvm-svn: 112233
2010-08-26 22:19:33 +00:00
Ted Kremenek c8bd967430 Remove redundant cast<...>.
llvm-svn: 112229
2010-08-26 22:04:01 +00:00
Dan Gohman ce46f02a32 Fix a typo.
llvm-svn: 112219
2010-08-26 21:27:06 +00:00
Chris Lattner d7e54804ee improve comments.
llvm-svn: 112214
2010-08-26 20:08:43 +00:00
Chris Lattner 07b71c4eb1 add radar #
llvm-svn: 112212
2010-08-26 20:05:48 +00:00
Chris Lattner d774ae9ed1 fix 2xi16 to pass as i32 instead of <2 x i16>. The former passes in
memory (as required) the later now passes in an xmm register.  This
fixes gcc.dg/compat/vector_1 on x86-32.

llvm-svn: 112211
2010-08-26 20:05:13 +00:00
Fariborz Jahanian 4fcc97f2f9 clang.xcodeproj updated.
llvm-svn: 112209
2010-08-26 19:58:26 +00:00
Chris Lattner 69e683fb35 vector of long and ulong are also classified as INTEGER in x86-64 abi,
this fixes rdar://8358475 a failure of the gcc.dg/compat/vector_1 abi
test.

llvm-svn: 112205
2010-08-26 18:13:50 +00:00
Chris Lattner 46830f2fd6 1 x ulonglong needs to be classified as INTEGER, just like 1 x longlong,
this fixes a miscompilation on the included testcase, rdar://8359248

llvm-svn: 112201
2010-08-26 18:03:20 +00:00
John McCall c162d1bbe4 ...I forgot to check my new test after adding it, and lo, there's slightly different
behavior in C than in C++ (which is what the original test case was).

llvm-svn: 112199
2010-08-26 17:42:30 +00:00
John McCall a3707cc7e2 Make sure we clear TypeSpecOwned when setting TypeSpecType to something when
it might previously have been a tag TST.

llvm-svn: 112196
2010-08-26 17:22:34 +00:00
Douglas Gregor 9ac1ad141b Tweak the @selector completion to collapse multiple informative and
typed-text blocks into one of each.

llvm-svn: 112194
2010-08-26 16:46:39 +00:00
Douglas Gregor 9be0ed4f3f When code-completing a potential call to a C++ non-static member
function, take into account the qualifiers on the object argument
(e.g., what will become "this"), filtering around uncallable member
functions and giving a slight priority boost to those with
exactly-matching qualifiers.

llvm-svn: 112193
2010-08-26 16:36:48 +00:00
John McCall 7a1da89f11 Work around a gcc warning.
llvm-svn: 112192
2010-08-26 16:36:35 +00:00
Argyrios Kyrtzidis 7648fb464b Fix miscompilation. The cookie was not used when new'ing arrays with multiple dimensions.
llvm-svn: 112188
2010-08-26 15:23:38 +00:00
Benjamin Kramer ead810e42b clang-interpreter: libFrontend depends on libSerialization. Fix linux build by changing the link order.
llvm-svn: 112187
2010-08-26 15:21:38 +00:00
Douglas Gregor 67c692cc3d Implement code completion for @selector expressions
llvm-svn: 112186
2010-08-26 15:07:07 +00:00
Douglas Gregor 78ccc2cb00 More ordering tweaks in this silly, silly test
llvm-svn: 112184
2010-08-26 14:20:32 +00:00
Gabor Greif e4d36a2415 mark boost's tracking bug as fixed
llvm-svn: 112183
2010-08-26 14:20:18 +00:00
Douglas Gregor 33551892fa Tweak wording in an assertion, from dawn@burble.org.
llvm-svn: 112182
2010-08-26 14:07:34 +00:00
Benjamin Kramer 1921fac97e Update clang-interpreter for recent DiagnosticClient ownership changes.
llvm-svn: 112181
2010-08-26 13:48:56 +00:00
Douglas Gregor 49f67ce4b3 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

3rd try. How embarrassing.

llvm-svn: 112180
2010-08-26 13:48:20 +00:00
John McCall ddeeb1022f Missed a couple.
llvm-svn: 112179
2010-08-26 10:20:09 +00:00
John McCall 3731f1234f Apparently gcc doesn't always get injected class names right.
llvm-svn: 112178
2010-08-26 09:52:08 +00:00
John McCall b1be523752 Move things around so that Sema.h no longer depends on even DeclBase.h.
It still depends on Type because DeclarationName.h does.

llvm-svn: 112177
2010-08-26 09:15:37 +00:00
Chris Lattner 51e1cc2fe2 tame an assertion, fixing rdar://8357396
llvm-svn: 112174
2010-08-26 06:28:35 +00:00
Daniel Dunbar d2bc53e925 CGValue: Increase width of allowed alignment. We could switch to log2, but we
don't currently need the bits anyway.

llvm-svn: 112173
2010-08-26 06:02:12 +00:00
Daniel Dunbar bef185c835 Revert r112149, "Move the sorting of code-completion results out of the main
path and ...", it is failing tests.

llvm-svn: 112161
2010-08-26 03:53:50 +00:00
Daniel Dunbar 60e3749181 Revert r112154, "Fix thinko in sorting operation", it depends on r112149 which
doth lay upon the chopping block.

llvm-svn: 112160
2010-08-26 03:53:44 +00:00
Douglas Gregor 54d9c11a01 Tweak test to avoid checking for a specific ordering where none exists
llvm-svn: 112159
2010-08-26 03:52:21 +00:00
John McCall 8e7d656a4a De-memberify the VarDecl and FunctionDecl StorageClass enums.
This lets us remove Sema.h's dependency on Expr.h and Decl.h.

llvm-svn: 112156
2010-08-26 03:08:43 +00:00
Douglas Gregor db967a58eb Fix thinko in sorting operation
llvm-svn: 112154
2010-08-26 02:54:05 +00:00
Dan Gohman e5334b484a Fix a typo.
llvm-svn: 112151
2010-08-26 02:27:03 +00:00
Douglas Gregor 78ecc499eb Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

llvm-svn: 112149
2010-08-26 02:23:45 +00:00
John McCall b45a1e735a Restore r112114 now that SmallVector<...,0> is safe.
llvm-svn: 112148
2010-08-26 02:13:20 +00:00
Eric Christopher 2a9898f0a2 Move some type defines from smmintrin.h to emmintrin.h to match where
gcc defines them.

llvm-svn: 112146
2010-08-26 02:09:25 +00:00
Ted Kremenek a594082210 Add libclang API hook "clang_getIBOutletCollectionType" to query the collection type for iboutletcollection attributes.
llvm-svn: 112139
2010-08-26 01:42:22 +00:00
Daniel Dunbar f241019e24 Driver/Darwin: Switch back to old toolchain, looks like new one isn't quite
ready yet.

llvm-svn: 112138
2010-08-26 01:41:44 +00:00
Chris Lattner 8c3283857e zap dead ctor
llvm-svn: 112132
2010-08-26 01:17:33 +00:00
Daniel Dunbar e3d87d21f3 IRgen/NEON: Fix codegen of vzip and vzipq.
- Will be adding an executable test case to test-suite repo.

llvm-svn: 112126
2010-08-26 00:55:57 +00:00
Daniel Dunbar b8f7a14575 Driver: Fix thinko where I switched to always using the old toolchain, instead
of always using the new toolchain.

llvm-svn: 112125
2010-08-26 00:55:55 +00:00
Daniel Dunbar e9f7151485 Driver/Darwin: Pass the right arch specific dir for ARM, when linking.
llvm-svn: 112124
2010-08-26 00:55:52 +00:00
Daniel Dunbar b6ceacf623 Revert r112114, "Pull DelayedDiagnostic and AccessedEntity out into their own
header.", it is teh broken.

llvm-svn: 112123
2010-08-26 00:52:50 +00:00
Eric Christopher a613f56559 With lax vector conversions (the default) make sure we convert between two
vectors that are the same size. Fix up testcases accordingly and add a new one
to make sure we still error if lax vector conversions are disabled.

Fixes rdar://8328190

llvm-svn: 112122
2010-08-26 00:42:16 +00:00
Douglas Gregor 1099865124 Revert "Move the sorting of code-completion results out of the main path and
into the clients", because the C standard library sucks. Where's my
stable sort, huh?

llvm-svn: 112121
2010-08-26 00:30:24 +00:00
Fariborz Jahanian 348dcffb14 Add DelayedDiagnostic.h to xcode project file.
llvm-svn: 112119
2010-08-26 00:17:38 +00:00
Fariborz Jahanian 40f9798d06 More update of clang.xcodeproj for recent changes.
llvm-svn: 112117
2010-08-26 00:13:24 +00:00
Fariborz Jahanian 3ee8bcebd0 Update clang.xcodeproj for recent refactorings.
llvm-svn: 112116
2010-08-26 00:06:40 +00:00
Eric Christopher 52d5ec11cc Fix typo in error message and testcase.
llvm-svn: 112115
2010-08-25 23:45:44 +00:00