Commit Graph

8479 Commits

Author SHA1 Message Date
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
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
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
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 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
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
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
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 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
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 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
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
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 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 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
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
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