Commit Graph

9374 Commits

Author SHA1 Message Date
Douglas Gregor 71395fa1d5 Implement support for parsing dependent template-ids that refer to
overloaded operators, e.g.,

  p->template operator+<T>()

llvm-svn: 85989
2009-11-04 00:56:37 +00:00
Mike Stump 71609a2874 Split out return adjustments in thunks from this adjustment in thunks
so the optimizer can tailcall into the return value adjustment thunk.
This improves codesize for complex hierarchies.

llvm-svn: 85988
2009-11-04 00:53:51 +00:00
Ted Kremenek b006b82daf Refactor StoreManager::BindDecl() to take a VarRegion* instead of a VarDecl*, and modify GRExprEngine::EvalBind() to handle decl initialization as well. This paves the way for adding "checker" visitation in EvalBind().
llvm-svn: 85983
2009-11-04 00:09:15 +00:00
Mike Stump 8117848174 Misc cleanups.
llvm-svn: 85978
2009-11-03 23:50:34 +00:00
Ted Kremenek 0fbbb0877d Change GRTransferFuncs::RegisterChecks() to take a GRExprEngine& instead of a BugReporter&. This paves the way for pulling some of the retain/release checker into a "Checker" class.
llvm-svn: 85971
2009-11-03 23:30:34 +00:00
Mike Stump 53f9ded62b Refine volatile handling, specifically, we must have the canonical
type to look at the volatile specifier.  I found these all from just
hand auditing the code.

llvm-svn: 85967
2009-11-03 23:25:48 +00:00
Douglas Gregor 3cf81317e4 Parsing and semantic analysis for template-ids that name overloaded
operators, e.g., 

  operator+<int>

which now works in declarators, id-expressions, and member access
expressions. This commit only implements the non-dependent case, where
we can resolve the template-id to an actual declaration.

llvm-svn: 85966
2009-11-03 23:16:33 +00:00
Mike Stump 96638affa6 We have to ensure we have the canonical type to do this. This is but
one instance of a large problem.  assert for non-canoical types would
help track down these things.

llvm-svn: 85956
2009-11-03 22:20:01 +00:00
Douglas Gregor 127ea59872 Tweak some comments about unqualified-id and id-expression parsing. No functionality change
llvm-svn: 85942
2009-11-03 21:24:04 +00:00
John McCall 5e6253bbd0 CFieldCallback doesn't need to create an ExtensionRAIIObject: it's actually
automatically shadowed by the ExtensionRAIIObject created by
ParseStructDeclaration.

llvm-svn: 85941
2009-11-03 21:13:47 +00:00
Douglas Gregor 7f4d7ea3a9 Remove a bunch of #if 0'd code made irrelevant by the latest ParseUnqualifiedId changes
llvm-svn: 85938
2009-11-03 20:53:48 +00:00
Fariborz Jahanian 7ad3616659 Remove previous patch for pr5296 due to further clarification
of value-initialization and trivial constructors.

llvm-svn: 85935
2009-11-03 20:38:53 +00:00
Chris Lattner e9d7d78ab3 Implement support for the -undef command line option, patch by
Roman Divacky! PR5363

llvm-svn: 85932
2009-11-03 19:50:27 +00:00
Chris Lattner 4f10559ba8 silence a warning.
llvm-svn: 85931
2009-11-03 19:48:51 +00:00
Douglas Gregor 30d60cb36e Replace the code that parses member access expressions after "." or
"->" with a use of ParseUnqualifiedId. Collapse
ActOnMemberReferenceExpr, ActOnDestructorReferenceExpr (both of them),
ActOnOverloadedOperatorReferenceExpr,
ActOnConversionOperatorReferenceExpr, and
ActOnMemberTemplateIdReferenceExpr into a single, new action
ActOnMemberAccessExpr that does the same thing more cleanly (and can
keep more source-location information).

llvm-svn: 85930
2009-11-03 19:44:04 +00:00
John McCall 37958aa864 Silence a warning by giving Parser::FieldCallback a virtual destructor, and
anchor the vtable to Parser.cpp for good measure.

llvm-svn: 85927
2009-11-03 19:33:12 +00:00
John McCall d5a36321b9 Reorganize the parsing of decl groups / function definitions so that
declarators are parsed primarily within a single function (at least for
these cases).  Remove some excess diagnostics arising during parse failures.

llvm-svn: 85924
2009-11-03 19:26:08 +00:00
Mike Stump 4627132ebc Refine codegen for covariant thunks that return references.
llvm-svn: 85916
2009-11-03 19:03:17 +00:00
Ted Kremenek 8d43a6ac3d Merge NullDerefChecker.[h,cpp] and UndefDerefChecker.[h,cpp]. They are essentially two parts of the same check.
llvm-svn: 85911
2009-11-03 18:41:06 +00:00
Mike Stump 77738205e6 Refine return value adjustments for thunks.
llvm-svn: 85905
2009-11-03 16:59:27 +00:00
Douglas Gregor a121b75d9d Use ParseUnqualifiedId when parsing id-expressions. This eliminates
yet another copy of the unqualified-id parsing code.

Also, use UnqualifiedId to simplify the Action interface for building
id-expressions. ActOnIdentifierExpr, ActOnCXXOperatorFunctionIdExpr,
ActOnCXXConversionFunctionExpr, and ActOnTemplateIdExpr have all been
removed in favor of the new ActOnIdExpression action.

llvm-svn: 85904
2009-11-03 16:56:39 +00:00
Mike Stump 462a4aa787 Fix documentation.
llvm-svn: 85901
2009-11-03 16:11:57 +00:00
Benjamin Kramer 8a712c7866 Update CMakeLists.
llvm-svn: 85898
2009-11-03 13:37:33 +00:00
Zhongxing Xu 27fee83ec4 Pull VLA size checker into its own files.
Split it to two checkers, one for undefined size, 
the other for zero size, so that we don't need to query the size
when emitting the bug report.

llvm-svn: 85895
2009-11-03 12:13:38 +00:00
Ted Kremenek 18c7ceee16 Implement: <rdar://problem/6250216> Warn against using -[NSAutoreleasePool release] in GC mode
llvm-svn: 85887
2009-11-03 08:03:59 +00:00
Ted Kremenek 924316d7d7 Move 'static inline' functions GetNullarySelector() and GetUnarySelector() from CFRefCount.cpp to ASTContext.h. These functions are likely to be generally useful.
llvm-svn: 85886
2009-11-03 08:00:42 +00:00
Zhongxing Xu 9b9d731a8b Pull AttrNonNullChecker into its own files.
llvm-svn: 85883
2009-11-03 07:35:33 +00:00
Zhongxing Xu b42929d773 Update CMake file.
llvm-svn: 85879
2009-11-03 07:14:39 +00:00
Ted Kremenek df8016aabb Rename NSErrorCheck to NSErrorChecker.
llvm-svn: 85877
2009-11-03 06:59:59 +00:00
Ted Kremenek 3684c65ded Update CMake file.
llvm-svn: 85876
2009-11-03 06:46:41 +00:00
Zhongxing Xu ab162e1873 Pull UndefinedArgChecker into its own files.
llvm-svn: 85875
2009-11-03 06:46:03 +00:00
Ted Kremenek 66791d5dc5 Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the target buffer needs to be resized. Fixes <rdar://problem/7255377>.
llvm-svn: 85872
2009-11-03 06:18:05 +00:00
Zhongxing Xu 0deca3486e Pull BadCallChecker into its own files.
llvm-svn: 85868
2009-11-03 05:48:04 +00:00
Ted Kremenek 43edaa8432 retain/release checker: CGBitmapContextCreateWithData() returns an owned object.
llvm-svn: 85867
2009-11-03 05:39:12 +00:00
Ted Kremenek d1b67db2e8 retain/release checker: Add special handling of CGBitmapContextCreateWithData().
Fixes: <rdar://problem/7358899>
llvm-svn: 85864
2009-11-03 05:34:07 +00:00
Chris Lattner 3deabca934 pr5371 likely has nothing to do with this.
llvm-svn: 85862
2009-11-03 05:11:39 +00:00
Mike Stump 92e5f8cb39 Refine codegen for non-virtual this adjustments for thunks.
llvm-svn: 85856
2009-11-03 03:16:46 +00:00
John McCall cfefb6d197 Switch ParseStructDeclaration to a callback-based API. This will make
it easier to track within Sema whether the parser is parsing a declaration.

llvm-svn: 85855
2009-11-03 02:38:08 +00:00
Mike Stump f358972fdc Add virtual adjustments for this for thunks.
llvm-svn: 85852
2009-11-03 02:12:59 +00:00
Douglas Gregor 7861a80346 Introduce a new class, UnqualifiedId, that provides a parsed
representation of a C++ unqualified-id, along with a single parsing
function (Parser::ParseUnqualifiedId) that will parse all of the
various forms of unqualified-id in C++.

Replace the representation of the declarator name in Declarator with
the new UnqualifiedId class, simplifying declarator-id parsing
considerably and providing more source-location information to
Sema. In the future, I hope to migrate all of the other
unqualified-id-parsing code over to this single representation, then
begin to merge actions that are currently only different because we
didn't have a unqualified notion of the name in the parser.

llvm-svn: 85851
2009-11-03 01:35:08 +00:00
Fariborz Jahanian a386d9533b Assortment of property attributes declared in continuation
class must match those of same property declared
in its primary class. (Fixes radar 7352425)

llvm-svn: 85843
2009-11-03 00:01:38 +00:00
Mike Stump 31e1d43729 Add basic codegen for thunks that return values.
llvm-svn: 85842
2009-11-02 23:47:45 +00:00
Mike Stump 33ccd9e354 Refine codegen for thunks.
llvm-svn: 85839
2009-11-02 23:22:01 +00:00
Ted Kremenek fac290d359 Remove GRExprEngine::CheckerVisitLocation(). It was only called in one place, so we inlined it in to GRExprEngine::EvalLocation().
llvm-svn: 85838
2009-11-02 23:19:29 +00:00
Fariborz Jahanian de8db16a7d Property declared in continuation class can only be used to
change a readonly property declared in the class (and its inherited protocols)
to writable property. (Fixes radar 7350645).

llvm-svn: 85836
2009-11-02 22:45:15 +00:00
John Thompson ac0b098d4d Added __has_include and __has_include_next.
llvm-svn: 85834
2009-11-02 22:28:12 +00:00
Daniel Dunbar 1e6add1fbb Remove unused header.
llvm-svn: 85828
2009-11-02 22:11:26 +00:00
Chris Lattner 3fab58d867 clean up namespace.
llvm-svn: 85826
2009-11-02 21:48:09 +00:00
Edward O'Callaghan 06231460b3 Add note to FIXME about PR5371.
llvm-svn: 85825
2009-11-02 21:25:11 +00:00
Fariborz Jahanian ec344ed2f5 Diagnose implementation of a property declared in a category
in its class implementation instead of crashing. Fixes radar 7350345.

llvm-svn: 85813
2009-11-02 18:45:36 +00:00
Douglas Gregor 0840cc02ce When determining whether a reference to a static data member is an
integral constant expression, make sure to find where the initializer
was provided---inside or outside the class definition---since that can
affect whether we have an integral constant expression (and, we need
to see the initializer itself).

llvm-svn: 85741
2009-11-01 20:32:48 +00:00
Douglas Gregor 5897e097a6 Within a template, qualified name lookup can refer to a non-dependent type
that is not known to be a base class at template definition time due
to some dependent base class. Treat qualified name lookup that refers
to a non-static data member or function as implicit class member
access when the "this" type would be dependent.

llvm-svn: 85718
2009-11-01 17:08:18 +00:00
Mike Stump 0a65b636ce Fix -pthread on dragonfly. Patch by Sascha Wildner.
llvm-svn: 85679
2009-10-31 20:11:46 +00:00
Mike Stump 75ce573815 Refine vcall/vbase ordering with vtable construction.
llvm-svn: 85677
2009-10-31 20:06:59 +00:00
Douglas Gregor 954de17977 Implement "incremental" template instantiation for non-type template
parameters and template type parameters, which occurs when
substituting into the declarations of member templates inside class
templates. This eliminates errors about our inability to "reduce
non-type template parameter depth", fixing PR5311.

Also fixes a bug when instantiating a template type parameter
declaration in a member template, where we weren't properly reducing
the template parameter's depth.

LLVM's StringSwitch header now parses.

llvm-svn: 85669
2009-10-31 17:21:17 +00:00
Benjamin Kramer 6b289a9cf6 Update CMake file.
llvm-svn: 85652
2009-10-31 12:15:23 +00:00
Zhongxing Xu b1c24724dd Move CheckDivZero into its own files.
llvm-svn: 85651
2009-10-31 10:02:37 +00:00
Zhongxing Xu 358ced08d0 Move UndefDerefChecker into its own file.
llvm-svn: 85645
2009-10-31 08:44:33 +00:00
Zhongxing Xu 5f5c954329 fix 80-col.
llvm-svn: 85642
2009-10-31 03:36:08 +00:00
Douglas Gregor 326b2fa03e Fix a crazy canonical-types bug because canonicalizing a
dependently-sized array type with a given expression might end up
returning a non-canonical type; see through that non-canonical type to
the underlying canonical type. Yes, I have a test case; no, I can't
reduce it to the point where it's worth checking in :(

llvm-svn: 85633
2009-10-30 22:56:57 +00:00
Douglas Gregor 62b885d43c When looking for a copy-assignment operator to determine the cv-qualifiers on its argument type, ignore assignment operator templates
llvm-svn: 85629
2009-10-30 22:48:49 +00:00
Douglas Gregor bb3b46eb74 When a friend is declared in a dependent context, don't even try to
match it up with a declaration in the outer scope.

llvm-svn: 85628
2009-10-30 22:42:42 +00:00
Douglas Gregor 1d0015f8e1 Improved fix for PR3844, which recovers better for class template
partial specializations and explicit instantiations of non-templates.

llvm-svn: 85620
2009-10-30 22:09:44 +00:00
Ted Kremenek 5c2040b182 Tighten computation of ExprVal using ?: expression. No functionality change.
llvm-svn: 85618
2009-10-30 22:01:29 +00:00
Douglas Gregor 916462b2f7 Improve diagnostics when parsing something like
template<> struct foo<int> { ... };

where "foo" does not refer to a template. Fixes PR3844.

llvm-svn: 85616
2009-10-30 21:46:58 +00:00
Douglas Gregor 412e8bc56d Instantiate class template friends better; fixes PR5332.
llvm-svn: 85612
2009-10-30 21:07:27 +00:00
Daniel Dunbar 624c21b029 Change the driver to do the Darwin triple mangling itself instead of forwarding
-mmacosx-version-min and -miphoneos-version-min to clang-cc.

llvm-svn: 85600
2009-10-30 18:12:20 +00:00
Ted Kremenek 6f2a705a24 Make checkers run in deterministic order.
llvm-svn: 85597
2009-10-30 17:47:32 +00:00
Ted Kremenek 89f5c189db Move NullDerefChecker.h instead a 'Checkers' subdirectory.
llvm-svn: 85596
2009-10-30 17:28:40 +00:00
Ted Kremenek f613e89617 Move all logic for the null dereference checker from GRExprEngineInternalChecks.cpp to a separate .cpp file.
llvm-svn: 85595
2009-10-30 17:24:47 +00:00
Douglas Gregor f329c7c3c0 Include macros in code-completion results
llvm-svn: 85594
2009-10-30 16:50:04 +00:00
John Thompson b535352681 Re-arranged some internal functions for coming __has_include changes.
llvm-svn: 85589
2009-10-30 13:49:06 +00:00
Benjamin Kramer 305f9f8fed Add C++ include paths for Exherbo. Patch by Daniel Mierswa!
llvm-svn: 85588
2009-10-30 12:57:13 +00:00
Zhongxing Xu b9eda67380 Fix PR5316: make assignment expressions can be visited as lvalue. Then we
can get the correct base lvalue.
Revert r85578.

llvm-svn: 85579
2009-10-30 07:19:39 +00:00
Ted Kremenek e96a30a531 Handle loading of field values from LazyCompoundVals in GRExprEngine::VisitMemberExpr().
This fixes the crash reported in PR 5316.

llvm-svn: 85578
2009-10-30 05:48:30 +00:00
Chris Lattner 252d36e74c warn about returning the address of a label.
llvm-svn: 85576
2009-10-30 04:01:58 +00:00
Anders Carlsson 32e1b1c169 Get throws limping along, still a bunch of FIXMEs. Too bad we don't support catching anything yet :)
llvm-svn: 85574
2009-10-30 02:27:02 +00:00
Anders Carlsson 958c9f8524 Fix thinko, mangleCXXRtti should obviously take a QualType!
llvm-svn: 85565
2009-10-30 01:52:02 +00:00
Anders Carlsson 4b08db7a62 Add CGException.cpp, to be used for exception related code generation.
llvm-svn: 85560
2009-10-30 01:42:31 +00:00
Anders Carlsson 430046321b mangleCXXRtti obviously needs to take a type, what was I thinking...
llvm-svn: 85555
2009-10-30 01:26:12 +00:00
Fariborz Jahanian 6c5a8e2555 This patch computes composite type of two objective-c expressions
used in a conditional expression by finding the most-derived common
super class of the two and qualifies the resulting type by the
intersection of the protocl qualifier list of the two objective-c
pointer types. ( this is continuation of radar 7334235).

llvm-svn: 85554
2009-10-30 01:13:23 +00:00
Anders Carlsson 3f0db2beb1 Add a CK_DerivedToBaseMemberPointer cast kind and use it in Sema (Still no codegen).
llvm-svn: 85552
2009-10-30 00:46:35 +00:00
John McCall 41b215eef6 Include pointee type information in the diagnostic for creating bad pointers or
arrays.

llvm-svn: 85550
2009-10-30 00:37:20 +00:00
John McCall 70dd5f6574 Report accurate source-location information when rebuilding types during
template instantiation.

llvm-svn: 85545
2009-10-30 00:06:24 +00:00
Mike Stump f3eb5ec2c0 Fix one more bug with __builtin_object_size.
llvm-svn: 85538
2009-10-29 23:34:20 +00:00
Douglas Gregor e6fb91f2cb We may need to instantiate a class template specialization as part of a derived-to-base pointer case
llvm-svn: 85532
2009-10-29 23:08:22 +00:00
Douglas Gregor 07cc4ac606 Slightly improve source-location information during template instantiation
llvm-svn: 85529
2009-10-29 22:21:39 +00:00
Steve Naroff f406f4d99b - Add/tweak some comments.
- change ObjCCategoryImplDecl::getCategoryClass() to getCategoryDecl().

No functionality change.

llvm-svn: 85528
2009-10-29 21:11:04 +00:00
Mike Stump fa50290b49 Fix some issues Daniel pointed out.
llvm-svn: 85526
2009-10-29 20:48:09 +00:00
Sebastian Redl adba46edc2 Properly instantiate usage of overloaded operator []. Fixes PR5345.
llvm-svn: 85524
2009-10-29 20:17:01 +00:00
John McCall 0d07eb32de A few TemplateArgumentLoc clean-ups. Try to remember the Expr for a declaration.
Provide an API for getting the SourceRange of a TAL and use it judiciously.

llvm-svn: 85520
2009-10-29 18:45:58 +00:00
Douglas Gregor ba91b89711 Yet more instantiation-location information. Fixes PR5336.
llvm-svn: 85516
2009-10-29 17:56:10 +00:00
Fariborz Jahanian c9076fecdf Patch for destruction of array of objects on block exit.
llvm-svn: 85512
2009-10-29 16:22:54 +00:00
Anders Carlsson 561f793890 Make sure to call CompleteConstructorCall for bases and members that are initialized implicitly in constructors so that default arguments etc are set correctly. Fixes PR5283.
llvm-svn: 85510
2009-10-29 15:46:07 +00:00
Nuno Lopes 09bd8656c3 make clang emit undefs for padding of structs and unions instead of zeros. this enables constant compaction optimizations.
llvm-svn: 85504
2009-10-29 11:27:06 +00:00
John McCall 0ad166672f Track source information for template arguments and template specialization
types.  Preserve it through template instantiation.  Preserve it through PCH,
although TSTs themselves aren't serializable, so that's pretty much meaningless.

llvm-svn: 85500
2009-10-29 08:12:44 +00:00
John McCall 588d2d585d Extract TemplateArgument into a new header just for common template
classes.  Move its implementation into a new module.

This will seem marginally more justified in a bit.

llvm-svn: 85499
2009-10-29 07:48:15 +00:00
Zhongxing Xu aa4121d062 Add an assertion to ensure NullDerefChecker exists.
llvm-svn: 85497
2009-10-29 05:56:54 +00:00
Ted Kremenek 1dbdbcc04c Fix accidental use of CheckSVal instead of CheckLocation, and add a
small test case to show we handle dereferences of undefined values.

llvm-svn: 85492
2009-10-29 05:33:39 +00:00
Douglas Gregor 98261735b4 StringSwitch-ify attribute name mapping.
llvm-svn: 85491
2009-10-29 05:26:58 +00:00