Commit Graph

10577 Commits

Author SHA1 Message Date
Anders Carlsson efa4732747 Pass the current SourceLocation to getAssignOperatorMethod, fixing a crash when the assign operator method needs to be instantiated. Doug, please review the updated default-assignment-operator.cpp change.
llvm-svn: 90935
2009-12-09 03:01:51 +00:00
Ted Kremenek 32c32892f7 Fix a horrid bug in GRExprEngine::CheckerVisit() that was identified
by the test case in PR 5627.  Essentially we shouldn't clear the
ExplodedNodeSet where we deposit newly constructed nodes if that set
is the 'Dst' set passed in.  It is not okay to clear that set because
it may already contain nodes.

llvm-svn: 90931
2009-12-09 02:45:41 +00:00
Chris Lattner 53d80e2c07 Neil points out that this could be simplified, do it.
llvm-svn: 90927
2009-12-09 02:08:14 +00:00
Mike Stump 85d9968533 Add support for the cleanup attribute for C++; we don't have to copy
all of g++'s bugs.

llvm-svn: 90924
2009-12-09 01:50:36 +00:00
Douglas Gregor 40cb9ad391 Implemented an implicit conversion from "noreturn" function types (and
pointers thereof) to their corresponding non-noreturn function
types. This conversion is considered an exact match for
overload-resolution purposes. Note that we are a little more strict
that GCC is, because we encode noreturn in the type system, but that's
a Good Thing (TM) because it does not allow us to pretend that
potentially-returning function pointers are non-returning function
pointers.

Fxies PR5620.

llvm-svn: 90913
2009-12-09 00:47:37 +00:00
Fariborz Jahanian e19122ff01 Added a missing case to a switch statement.
llvm-svn: 90902
2009-12-08 23:46:15 +00:00
Daniel Dunbar e07f152e6d Increase inlining threshold at -O3, to match llvm-gcc.
llvm-svn: 90897
2009-12-08 23:15:55 +00:00
Fariborz Jahanian 859c415567 More detailed analysis of typecast to an objective-c pointer
in objective-c++ mode without being too lenient.

llvm-svn: 90895
2009-12-08 23:09:15 +00:00
John McCall 3a60c87a59 Handle unresolved using decls in bare lookups. These are not being adequately
tested.  Fixes PR5727.

llvm-svn: 90893
2009-12-08 22:45:53 +00:00
Mike Stump 4a6b337cfd Add fixme.
llvm-svn: 90884
2009-12-08 22:12:48 +00:00
Mike Stump e6d54ca553 Remove some old code. WIP.
llvm-svn: 90882
2009-12-08 21:46:41 +00:00
Douglas Gregor 9291ab6d80 Don't expand tabs when computing the offset from the code-completion column
llvm-svn: 90881
2009-12-08 21:45:46 +00:00
Douglas Gregor df72af5935 Pick up MB_LEN_MAX as defined by the system <limits.h>, when it's provided there
llvm-svn: 90879
2009-12-08 21:35:00 +00:00
Daniel Dunbar 17c4f8d746 Update CGExprConstant for change to emit padding values as undef.
- This fixes 2003-05-21-BitfieldHandling.

llvm-svn: 90876
2009-12-08 21:12:32 +00:00
Fariborz Jahanian 33e148f64b Patch to allow matching 0 with an objective-c pointer type
in objective-c++ mode. Fixes radar 7443165

llvm-svn: 90874
2009-12-08 20:04:24 +00:00
Daniel Dunbar 6cc525b44e Unbreak clang-cc handling of -msoft-float / -mfloat-abi=, which I borked.
llvm-svn: 90873
2009-12-08 19:49:51 +00:00
Fariborz Jahanian 1c548021ec Patch to allow cstyle cast of objective-c pointers in objective-c++
mode as they are pervasive.

llvm-svn: 90867
2009-12-08 19:22:33 +00:00
Fariborz Jahanian 410f2ebdb6 Refactor objective-c pointer assignment compatibility logic. No
intended functionality change.

llvm-svn: 90865
2009-12-08 18:24:49 +00:00
Douglas Gregor 049bdcac49 Implement template instantiation for exception specifications. Also,
print exception specifications on function types and
declarations. Fixes <rdar://problem/7450999>.

There is some poor source-location information here, because we don't
track locations of the types in exception specifications. Filed PR5719.

Failures during template instantiation of the signature of a function
or function template have wrong point-of-instantiation location
information. I'll tackle that with a separate commit.

llvm-svn: 90863
2009-12-08 17:45:32 +00:00
Steve Naroff 04bc01833e Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=80043

llvm-svn: 90860
2009-12-08 16:38:12 +00:00
Douglas Gregor a64c1e5452 When performing unqualified name lookup in C++, don't look directly
into transparent contexts; instead, we'll look into their nearest
enclosing non-transparent contexts further up the stack. Fixes PR5479.

llvm-svn: 90859
2009-12-08 15:38:36 +00:00
Benjamin Kramer ba8451b243 Use StringRef in CGDebugInfo::EmitFunctionStart.
llvm-svn: 90856
2009-12-08 14:04:35 +00:00
Benjamin Kramer 43c7c5befd Use a Twine to concatenate the name instead of going through std::string.
llvm-svn: 90854
2009-12-08 13:07:37 +00:00
Benjamin Kramer c6ad84cb3c Twinify InitHeaderSearch::AddPath and use it in C++ include path generation.
llvm-svn: 90853
2009-12-08 12:38:20 +00:00
Benjamin Kramer 141c7f987a Use StringRefs in InitHeaderSearch::AddDelimitedPaths.
llvm-svn: 90852
2009-12-08 12:11:06 +00:00
Benjamin Kramer 1d20564b8d Use Path.makeAbsolute() and make a constant std::string a const char*.
llvm-svn: 90851
2009-12-08 11:02:29 +00:00
John McCall 47f29ea8e0 The refactor of implicit member access expressions means we don't need this
horrible isAddressOfOperand hack in TreeTransform, since that syntactic
information is managed by the initial parser callbacks now.

That's enough insomniac commits for one night.

llvm-svn: 90849
2009-12-08 09:21:05 +00:00
John McCall ce54657e95 DeclRefExpr stores a ValueDecl internally.
Template instantiation can re-use DeclRefExprs.

llvm-svn: 90848
2009-12-08 09:08:17 +00:00
Zhongxing Xu fe2f901269 Refactor builtin function evaluation into a checker.
llvm-svn: 90847
2009-12-08 09:07:59 +00:00
John McCall 3969e30d38 Correctly implement the C++03 and 0x restrictions on class-member using
declarations.

llvm-svn: 90843
2009-12-08 07:46:18 +00:00
John McCall ddabf1a946 Add CXXRecordDecl::forallBases to walk an inheritance hierarchy with non-lookup
semantics and CXXRecordDecl::isProvablyNotDerivedFrom to assist with
pre-instantiation diagnostics.

llvm-svn: 90842
2009-12-08 07:42:38 +00:00
Eli Friedman 80888c7b38 Build fix.
llvm-svn: 90841
2009-12-08 06:54:20 +00:00
Eli Friedman bb5008a32a Fix for PR5707: make sure implicit copy constructors initialize the vtable
pointer.

llvm-svn: 90840
2009-12-08 06:46:18 +00:00
Eli Friedman 897bc03305 Small compatibility fix for -print-decl-contexts.
llvm-svn: 90838
2009-12-08 06:22:37 +00:00
Eli Friedman 7316819fcf Fix for PR5710: make sure to put function template specializations into the
DeclContext, so they don't completely disappear from the AST.

I don't particularly like this fix, but I don't see any obviously better way
to deal with it, and I think it's pretty clearly an improvement; comments
welcome.

llvm-svn: 90835
2009-12-08 05:40:03 +00:00
Eli Friedman 48c6b0d14f Slight tweak to vtable linkage.
llvm-svn: 90832
2009-12-08 04:09:14 +00:00
Eli Friedman f2c79b6b9c Misc key function fixes.
llvm-svn: 90831
2009-12-08 03:56:49 +00:00
Fariborz Jahanian 4569f69558 Patch to warn when discarding objective-c pointer type qualifiers
Still some refactoring to do.

llvm-svn: 90830
2009-12-08 03:35:08 +00:00
Eli Friedman be6f4cffca Get rid of some diagnostics that don't follow our rules for -pedantic
diagnostics (specifically, that any extension in a compiler-reserved namespace
shouldn't trigger a diagnostic).

llvm-svn: 90826
2009-12-08 02:22:26 +00:00
Eli Friedman 8aaff69e86 Fix some direct checks of expressions which might be surrounded by parentheses.
llvm-svn: 90825
2009-12-08 02:09:46 +00:00
Eli Friedman cd6a50f3e5 Make copy assignment operator synthesis not explode for classes with complex
or non-record aggregate members.

It might be worth spending some time to optimize this code (and the parallel
code for copy constructors) to memcpy in larger chunks, rather than copying
one member at a time.  Not sure exactly how beneficial that would be, but
it seems like could help for large classes with, for example, a vtable pointer
forcing the generation of a copy constructor.

llvm-svn: 90823
2009-12-08 01:57:53 +00:00
Jeffrey Yasskin 567ae47b4a Remove several .c_str() to be forward-compatible with StringRef.
llvm-svn: 90822
2009-12-08 01:46:24 +00:00
Mike Stump 02c23d68cb Fixup catch parameters with class reference type. WIP.
llvm-svn: 90821
2009-12-08 01:29:31 +00:00
Anders Carlsson 220bf4fc5a No need to add tail padding if the resulting LLVM struct type will have the same size as the final record size.
llvm-svn: 90820
2009-12-08 01:24:23 +00:00
Eli Friedman 31bc3ad275 A bunch more thunk fixes from misc testing.
(Yes, I do intend to commit some tests for this.)

llvm-svn: 90818
2009-12-07 23:56:34 +00:00
Mike Stump 1d849219a5 Add codegen support for exception specifications. WIP.
llvm-svn: 90817
2009-12-07 23:38:24 +00:00
John McCall a928c652be Recover from dot accesses to record pointers and arrow accesses to records.
Patch by Nicola Gigante!

llvm-svn: 90814
2009-12-07 22:46:59 +00:00
Ted Kremenek 7bea9a1672 Enable '-analyzer-opt-analyze-nested-blocks' by default for testing.
llvm-svn: 90812
2009-12-07 22:26:14 +00:00
Ted Kremenek 6818991d71 Add clang-cc option '-analyzer-opt-analyze-nested-blocks' to treat block literals as an entry point for analyzer checks.
llvm-svn: 90810
2009-12-07 22:06:12 +00:00
Ted Kremenek 04af9f20fb Add analysis support for blocks. This includes a few key changes:
- Refactor the MemRegion hierarchy to distinguish between different StackSpaceRegions for locals and parameters.
- VarRegions for "captured" variables now have the BlockDataRegion as their super region (except those passed by reference)
- Add transfer function support to GRExprEngine for BlockDeclRefExprs.

This change also supports analyzing blocks as an analysis entry point
(top-of-the-stack), which required pushing more context-sensitivity
around in the MemRegion hierarchy via the use of LocationContext
objects.  Functionally almost everything is the same, except we track
LocationContexts in a few more areas and StackSpaceRegions now refer
to a StackFrameContext object.  In the future we will need to modify
MemRegionManager to allow multiple StackSpaceRegions in flight at once
(for the analysis of multiple stack frames).

llvm-svn: 90809
2009-12-07 22:05:27 +00:00
Ted Kremenek 54ad1ab56f Add the BlockDecl to the DeclContext.
llvm-svn: 90808
2009-12-07 22:01:30 +00:00
Eli Friedman f6c175b745 Correctly handle conditional operators involving throw.
llvm-svn: 90800
2009-12-07 20:25:53 +00:00
Eli Friedman 5445f6e5b6 Make the comma operator consistently call EnsureInsertPoint.
llvm-svn: 90799
2009-12-07 20:18:11 +00:00
Mike Stump 62afe99814 Work around emitters that can't deal with dead code contexts yet.
llvm-svn: 90796
2009-12-07 20:12:14 +00:00
Fariborz Jahanian c2949f9f26 Allow accessing 'isa' via '->' operator.
(fixes radar 7447251).

llvm-svn: 90795
2009-12-07 20:09:25 +00:00
Anders Carlsson 1aaecfa02d Mangle basic_ostream and basic_iostream specializations.
llvm-svn: 90794
2009-12-07 19:56:42 +00:00
Mike Stump 52d7141186 Remove obsolete fallback code for objectsize.
llvm-svn: 90780
2009-12-07 18:58:11 +00:00
Nuno Lopes 7251327d75 implement PR5274: mark 'restrict' parameters as noalias
llvm-svn: 90778
2009-12-07 18:30:06 +00:00
Rafael Espindola 59ae799efa Shorten the help test for -no-canonical-prefixes, put it behind HelpHidden and
claim it in Driver.cpp instead of Tools.cpp.

llvm-svn: 90777
2009-12-07 18:28:29 +00:00
Fariborz Jahanian 1b31c37922 Patch to allow restrict applied to id/Class types.
(fixes radar 7442244).

llvm-svn: 90773
2009-12-07 18:08:58 +00:00
Nuno Lopes c4413fbb88 add fedora 12 include path
llvm-svn: 90772
2009-12-07 17:18:48 +00:00
Chris Lattner 3ababf5340 reduce nesting.
llvm-svn: 90769
2009-12-07 16:33:19 +00:00
Douglas Gregor 9225369891 When in an Objective-C instance method, super is a valid code-completion result
llvm-svn: 90758
2009-12-07 09:54:55 +00:00
Douglas Gregor bc7c5e471a Code completion for Objective-C @ keywords that are statements or expressions
llvm-svn: 90757
2009-12-07 09:51:25 +00:00
Douglas Gregor f48706c787 Code completion for Objective-C @ directives
llvm-svn: 90756
2009-12-07 09:27:33 +00:00
Zhongxing Xu 175447f743 Add EvalCallExpr interface to checker, and migrate the no-return function
handler to this interface.
GRExprEngine::CheckerEvalCall() will return true if one of the checkers has
processed the node. In the future this might return void when we have some 
default checker.

llvm-svn: 90755
2009-12-07 09:17:35 +00:00
Anders Carlsson 8e0317bf05 Instantiated or specialized class templates never have a key function. This (and the previous check-in) fixes PR5557.
llvm-svn: 90753
2009-12-07 08:29:39 +00:00
Anders Carlsson 82fccd014a Rework how virtual member functions are marked. If a class has no key function, we now wait until the end of the translation unit to mark its virtual member functions as references. This lays the groundwork for fixing PR5557.
llvm-svn: 90752
2009-12-07 08:24:59 +00:00
Anders Carlsson e1b3e6292a It's OK to try to emit a vtable definition more than once. Fixes PR5697.
llvm-svn: 90751
2009-12-07 07:59:52 +00:00
Anders Carlsson 27cfc6e144 getTemplateSpecializationKind should be const.
llvm-svn: 90750
2009-12-07 06:33:48 +00:00
Eli Friedman c0dacee1e0 Erm, revert for the moment; I didn't test this as thoroughly as I should have
(although it does pass regression tests).

llvm-svn: 90747
2009-12-07 04:45:50 +00:00
Eli Friedman c5d3a6ae3d Tweak the formula for non-virtual offsets to something which appears a bit
more accurate.

llvm-svn: 90746
2009-12-07 04:38:34 +00:00
Anders Carlsson 5ebf8b44e9 Move key functions to a separate map.
llvm-svn: 90745
2009-12-07 04:35:11 +00:00
John McCall bcd035061d DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables,
but the results are imperfect.

For posterity, I did:

cat <<EOF > $cmdfile
s/DeclaratorInfo/TypeSourceInfo/g
s/DInfo/TInfo/g
s/TypeTypeSourceInfo/TypeSourceInfo/g
s/SourceTypeSourceInfo/TypeSourceInfo/g
EOF

find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \;
find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \;
find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \;

llvm-svn: 90743
2009-12-07 02:54:59 +00:00
Chris Lattner 9dfed9fdb6 fix -dM with variadic macros, PR5699
llvm-svn: 90735
2009-12-07 01:58:34 +00:00
Chris Lattner 76b4445d6f some code cleanup.
llvm-svn: 90732
2009-12-07 01:42:56 +00:00
Chris Lattner d62268a668 remove some defaulted params for consistency.
llvm-svn: 90731
2009-12-07 01:38:03 +00:00
Chris Lattner 1c4280328d reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.
This time with a fix to bail out when in a dependent context.

llvm-svn: 90730
2009-12-07 01:36:53 +00:00
Chris Lattner 045cbffb65 fix a crash on invalid I found when working on something unrelated.
llvm-svn: 90729
2009-12-07 00:48:47 +00:00
Eli Friedman d0e8de2cd8 Move RequireCompleteType requirement for fields early into ActOnField so that
subsequent code which depends on a complete type does the right thing.

llvm-svn: 90727
2009-12-07 00:22:08 +00:00
Sam Weinig d060ed4d70 Don't print a void return type for C++ constructors and destructors when generating a predefined expr for them.
llvm-svn: 90725
2009-12-06 23:55:13 +00:00
Eli Friedman f2eda5efd2 Be a bit more complete about accumulating SavedThisAdjustments.
llvm-svn: 90723
2009-12-06 22:33:51 +00:00
Eli Friedman 8174f2c23c Work-in-progess rewrite of thunks: move thunk generation outside of vtable
generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.

llvm-svn: 90722
2009-12-06 22:01:30 +00:00
Douglas Gregor 94bb5e8d75 PointerUnion == PointerUnion does not do what I thought it did. Also, fix a thinko in a PointerUnion::get call.
llvm-svn: 90719
2009-12-06 21:27:58 +00:00
Steve Naroff 30484700c5 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=81871
http://llvm.org/viewvc/llvm-project?view=rev&revision=81936
http://llvm.org/viewvc/llvm-project?view=rev&revision=81945

llvm-svn: 90718
2009-12-06 21:14:13 +00:00
Chris Lattner ed085234dc revert my previous patch, it is breaking something and I don't have time
to fix it ATM.

llvm-svn: 90717
2009-12-06 20:58:07 +00:00
Eli Friedman 71a26d8f82 Move helper onto CXXMethodDecl.
llvm-svn: 90716
2009-12-06 20:50:05 +00:00
Douglas Gregor 05e7ca3659 Switch the std::multimap shadow map used in code completion to an
llvm::DenseMap, for a 20% performance improvement in the
Cocoa-big-list performance benchmark.

llvm-svn: 90715
2009-12-06 20:23:50 +00:00
Chris Lattner 71d5bf1c5d implement PR4451, improving error recovery for a mistaken : where a :: was
intended.  On the first testcase in the bug, we now produce:

cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier
y:a a2;
 ^
 ::

instead of:

t.cc:8:1: error: C++ requires a type specifier for all declarations
x:a a2;
^
t.cc:8:2: error: invalid token after top level declarator
x:a a2;
 ^
 ;
t.cc:9:11: error: use of undeclared identifier 'a2'
x::a a3 = a2;
          ^

llvm-svn: 90713
2009-12-06 19:08:11 +00:00
Chris Lattner 8c56c49fe0 simplify logic.
llvm-svn: 90712
2009-12-06 18:34:27 +00:00
Anders Carlsson 3efc6e6f46 Add rudimentary support for member pointers to CGDebugInfo.
llvm-svn: 90711
2009-12-06 18:00:51 +00:00
Chris Lattner 3c7b86f4ee remove some extraneous syntax: sourceloc implicitly converts to sourcerange.
llvm-svn: 90710
2009-12-06 17:36:05 +00:00
Chris Lattner 72ecc68e11 use new helpers to simplify code.
llvm-svn: 90709
2009-12-06 17:22:42 +00:00
Daniel Dunbar a6cb9f21be Fix an off by one in findEndOfWord, which could scan past the end of the string in a corner case.
llvm-svn: 90703
2009-12-06 09:56:18 +00:00
Eli Friedman eddf1213e2 Fix a slight oversight in computing whether a copy constructor is elidable.
Fixes PR5695.

llvm-svn: 90702
2009-12-06 09:26:33 +00:00
Daniel Dunbar 58ecb2ab51 Unbreak and add test case for r90276, a situation in which getBuffer is expected to fail.
Also, update SourceManager.h doxyments for getBuffer() to reflect reality.

llvm-svn: 90701
2009-12-06 09:19:25 +00:00
Daniel Dunbar 1776679e71 Change Preprocessor::EnterSourceFile to make ErrorStr non-optional, clients should be forced to deal with error conditions.
llvm-svn: 90700
2009-12-06 09:19:12 +00:00
Daniel Dunbar 7cea5f1747 Add a pretty horrible hack to prevent clang from crashing with inconsistent PCH
files.
 - The issue is that PCH uses a stat cache, which may reference files which have
   been deleted or moved. In such cases ContentCache::getBuffer was returning 0
   but most clients are incapable of dealing with this (i.e., they don't).

   For the time being, resolve this issue by just making up some invalid file
   contents and. Eventually we should detect that we are in an inconsistent
   situation and error out with a nice message that the PCH is out of date.

llvm-svn: 90699
2009-12-06 05:43:36 +00:00
Steve Naroff 287a2bfc03 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=86026

Note: The 'improved debugging' changes weren't integrated (since they were later reverted, since they didn't improve debugging).
llvm-svn: 90693
2009-12-06 01:52:22 +00:00
Steve Naroff 94ed6dc906 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=82174

llvm-svn: 90692
2009-12-06 01:48:44 +00:00