Commit Graph

5123 Commits

Author SHA1 Message Date
Ted Kremenek 02627a22cf Fix indentation.
llvm-svn: 113476
2010-09-09 06:53:59 +00:00
Ted Kremenek b8176da314 Check format strings when a called function has more than one FormatAttr (one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.
llvm-svn: 113472
2010-09-09 04:33:05 +00:00
Ted Kremenek 1520dae606 It appears that technically a null format string is not warned under -Wformat-nonliteral, as
the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log).  Fixes <rdar://problem/8269537>.

llvm-svn: 113469
2010-09-09 03:51:42 +00:00
Ted Kremenek 808829351e Avoid redundant recursive calls in SemaCheckStringLiteral by just updating the expression
and trying again.

llvm-svn: 113468
2010-09-09 03:51:39 +00:00
Ted Kremenek bc5860b652 Remove tabs I accidentally introduced.
llvm-svn: 113467
2010-09-09 02:57:51 +00:00
Ted Kremenek 0f107e4386 Relax __attribute_((nonnull)) checking to allow the attribute on functions with no pointer arguments. GCC doesn't warn
in this case, and the attribute is trivially satisfied (and benign).  Fixes <rdar://problem/8364828>.

llvm-svn: 113464
2010-09-09 01:17:32 +00:00
Ted Kremenek 50205744c3 Enhance -Wreturn-type to not warn when control-flow is most likely limited by a switch statement explicitly covering
all the cases for an enum value.

llvm-svn: 113450
2010-09-09 00:06:07 +00:00
Ted Kremenek c42f345157 When building SwitchStmts in Sema, record whether all the enum values of a switch(enum) where
covered by individual case statements.  Flow-based analyses may wish to consult this information,
and recording this in the AST allows us to obviate reconstructing this information later when
we build the CFG.

llvm-svn: 113447
2010-09-09 00:05:53 +00:00
Douglas Gregor a5614c5fe8 Push the range associated with a nested-name-specifier further through
TreeTransform, since we were getting an empty source range where we
shouldn't. Sadly, the test case is Boost.Proto, and isn't worth
reducing.

llvm-svn: 113446
2010-09-08 23:56:00 +00:00
Douglas Gregor 4c7c109eec Fix a few minor issues with parsing and semantic analysis of C++
typeid expressions: 
  - make sure we have a proper source location for the closing ')'
  - cache the declaration of std::type_info once we've found it

llvm-svn: 113441
2010-09-08 23:14:30 +00:00
Douglas Gregor 67da50e18d When providing a completion for a function/method parameter of block
pointer type, actually provide a usable block literal expression.

llvm-svn: 113431
2010-09-08 22:47:51 +00:00
Douglas Gregor b2f0713ddc Clean up some of the CMake dependencies
llvm-svn: 113416
2010-09-08 21:40:53 +00:00
Douglas Gregor 8ec5173f9a Use the new-initialization code for initializing scalars with a
function-style cast. Previously, we had a (redundant, incorrect)
semantic-checking path for non-class types, which allowed
value-initialization of a reference type and then crashed.

llvm-svn: 113415
2010-09-08 21:40:08 +00:00
Fariborz Jahanian db45278cbd Reverse r113397 until we decide what to do with
use of 'struct objc_object*' for 'is' (and others)
in clang.

llvm-svn: 113414
2010-09-08 21:36:35 +00:00
Bill Wendling 73f59c433d Initialize the MSVCGuidDecl variable in the correct order.
llvm-svn: 113412
2010-09-08 21:30:16 +00:00
Fariborz Jahanian 40efc0feb4 Fix a crash when overloading id with objc_object*.
Radar 8400356.

llvm-svn: 113397
2010-09-08 20:08:18 +00:00
Francois Pichet 9f4f2078d6 Microsoft's __uuidof operator implementation part 1.
llvm-svn: 113356
2010-09-08 12:20:18 +00:00
Francois Pichet 4ad4b58639 Allow type definitions inside anonymous struct/union in Microsoft mode.
llvm-svn: 113354
2010-09-08 11:32:25 +00:00
Sebastian Redl 02f1eebdc0 Don't give 'global constructor' warnings for function statics, even if they have a direct initializer. Fixes PR8095.
llvm-svn: 113344
2010-09-08 04:46:19 +00:00
Sebastian Redl a190d3605f Allow (cv) void and incomplete arrays to be passed to the type traits.
Fixes PR8110, and thus PR8109, PR8097, and parts of PR8101, PR8105 and PR8107. Only a few traits have tests for incomplete arrays, since I'm not yet clear what the result for them should be; Howards wants to file a DR to change the standard.

llvm-svn: 113326
2010-09-08 00:48:43 +00:00
Gabor Greif 80c218386f add a fixit when 'main' does ot return 'int'; review welcome
llvm-svn: 113324
2010-09-08 00:31:13 +00:00
Douglas Gregor 2b88c115f9 Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.

llvm-svn: 113319
2010-09-08 00:15:04 +00:00
Douglas Gregor 0744ef6371 Improve source-location information for CXXNewExpr, by hanging on to
the TypeSourceInfo for the allocated type. Fixes PR7501.

llvm-svn: 113291
2010-09-07 21:49:58 +00:00
Fariborz Jahanian 56603ef7b2 Have Sema check for validity of CGString literal
instead of asserting in IRGen. Fixes radar 8390459.

llvm-svn: 113253
2010-09-07 19:38:13 +00:00
Douglas Gregor a7d6e3d0f5 Provide a specific diagnostic when trying to redefine an "extern
inline" function outside of GNU89 mode. Fixes
<rdar://problem/6880464>.

llvm-svn: 113204
2010-09-07 15:51:01 +00:00
Eli Friedman 8ed2bac65d PR8023: Don't crash on invalid uses of __real__ on class types in C++.
llvm-svn: 113124
2010-09-05 23:15:52 +00:00
Chris Lattner a3d232ad27 zap more dead code.
llvm-svn: 113076
2010-09-04 18:19:08 +00:00
Chris Lattner 9795b39113 zap dead code.
llvm-svn: 113074
2010-09-04 18:12:20 +00:00
Douglas Gregor 09c0eb1510 Synchronize code-completion cursor kinds with indexing cursor
kinds. How shameful that this code was duplicated!

llvm-svn: 113033
2010-09-03 23:30:36 +00:00
Chandler Carruth f92bd8cf22 Fix PR7402 when it strikes via template instantiation.
llvm-svn: 113019
2010-09-03 21:54:20 +00:00
Anders Carlsson f849774495 It's OK for classes to have flexible array elements (but not unions).
llvm-svn: 113018
2010-09-03 21:53:49 +00:00
Chandler Carruth 9bb67f4d1a Allow anonymous and local types. The support was already in place for these,
but this makes them work even as an extension in C++98. This resolves PR8077.

llvm-svn: 113011
2010-09-03 21:12:34 +00:00
Douglas Gregor c4ef180dd2 Simplify code-completion result sorting a bit
llvm-svn: 112968
2010-09-03 16:23:44 +00:00
John McCall 417e74491c Add a quick-and-dirty hack to give a better diagnostic for [class.protected]
restrictions.  The note's not really on the right place given its wording,
but putting a second note on the call site (or muddying the wording) doesn't
appeal.

There are corner cases where this can be wrong, but I'm not concerned.

llvm-svn: 112950
2010-09-03 04:56:05 +00:00
Chris Lattner 3dd48bd169 "I see dead code". IdempotentOperationChecker::isTruncationExtensionAssignment
should probably be removed if it has no purpose, but I just #if'd it out
in case it's usefulIdempotentOperationChecker::isTruncationExtensionAssignment
should probably be removed if it has no purpose, but I just #if'd it out
in case it's useful

llvm-svn: 112949
2010-09-03 04:34:38 +00:00
John McCall 96326e447c Devirtualize Sema, kill off DeleteExpr and DeleteStmt, and reformat.
llvm-svn: 112945
2010-09-03 02:10:08 +00:00
Dawn Perchik 335e16bad4 Add symantic support for the Pascal calling convention via
"__attribute((pascal))" or "__pascal" (and "_pascal" under
-fborland-extensions).  Support still needs to be added to llvm.

llvm-svn: 112939
2010-09-03 01:29:35 +00:00
Anders Carlsson 4013404eff Static local variables don't result in global constructors being emitted.
llvm-svn: 112933
2010-09-03 01:11:38 +00:00
Anders Carlsson 4399668652 Remove now unused function.
llvm-svn: 112927
2010-09-03 00:51:09 +00:00
Anders Carlsson af7534f084 Get rid of the "functions declared 'noreturn' should have a 'void' result type" warning.
The rationale behind this is that it is normal for callback functions to have a non-void return type
and it should still be possible to mark them noreturn. (JavaScriptCore is a good example of this).

llvm-svn: 112918
2010-09-03 00:25:02 +00:00
Douglas Gregor 6429f5cf29 Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.

llvm-svn: 112868
2010-09-02 21:50:02 +00:00
Ted Kremenek cbe6b0b846 Enhance return-stack-address check (in Sema) to handle fields that themselves are references. (Fixes PR 7999; fix by Chandler Carruth).
llvm-svn: 112792
2010-09-02 01:12:13 +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
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
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
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
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 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
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