Commit Graph

1599 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 2b1ef227f5 Handle ambiguities between expressions and type-ids that occur inside parentheses, e.g.:
sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.

llvm-svn: 57131
2008-10-05 19:56:22 +00:00
Chris Lattner 4ecd753486 eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
integer size #defines over to the Preprocessor.

llvm-svn: 57130
2008-10-05 19:44:25 +00:00
Chris Lattner 248d3c4192 gcc no longer defines __block to nothing when blocks aren't enabled.
llvm-svn: 57129
2008-10-05 19:32:52 +00:00
Chris Lattner 1f7e2d5430 rearrange preprocessor macro definitions into language-specific
then target specific.

llvm-svn: 57128
2008-10-05 19:32:22 +00:00
Chris Lattner f37bafc5ca Implement PR2773, support for __USER_LABEL_PREFIX__
llvm-svn: 57127
2008-10-05 19:22:37 +00:00
Argyrios Kyrtzidis df788f4eea Found a subtle bug caused by an implicit enum-to-bool conversion (of the TentativeParsingResult enum).
This was the motivation of the following changes:

-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).

llvm-svn: 57125
2008-10-05 18:52:21 +00:00
Anders Carlsson c181b01681 Add parsing of the sentinel attribute. Still need to create the attribute.
llvm-svn: 57121
2008-10-05 18:05:59 +00:00
Chris Lattner 465fa32cd5 Wrap long lines and other minor cleanups, no functionality change.
llvm-svn: 57119
2008-10-05 17:34:18 +00:00
Anders Carlsson c442c92b6f Remove copyright notice, we decided not to have them.
llvm-svn: 57118
2008-10-05 17:21:08 +00:00
Argyrios Kyrtzidis bc28fefcde Disambiguate between a declaration or an expression, in the 'for-init-statement' part of a 'for' statement.
llvm-svn: 57112
2008-10-05 15:50:46 +00:00
Argyrios Kyrtzidis 2534620b4e Fix Parser::isCXXConditionDeclaration to properly resolve declarations.
llvm-svn: 57111
2008-10-05 15:19:49 +00:00
Argyrios Kyrtzidis 71f3e19df0 Disambiguate between a declaration or expression for the 'condition' part of a if/switch/while/for statement.
llvm-svn: 57109
2008-10-05 15:03:47 +00:00
Argyrios Kyrtzidis 7b87f27438 Consider GNU attributes when doing ambiguity resolution.
llvm-svn: 57108
2008-10-05 14:27:18 +00:00
Zhongxing Xu 8c9771bdf0 Remove redundant parameter and rename StMgr to StateMgr.
llvm-svn: 57107
2008-10-05 12:12:48 +00:00
Daniel Dunbar b8ed192605 Make VectorType printing less broken.
- Print size as number of elements times "sizeof(elt type)", not
   perfect but better than just printing the completely wrong type.

llvm-svn: 57100
2008-10-05 05:43:11 +00:00
Argyrios Kyrtzidis 2c7137d8d1 Resolve ambiguous C++ statements (C++ 6.8p1).
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them.

llvm-svn: 57084
2008-10-05 00:06:24 +00:00
Daniel Dunbar 3ca0a634c2 Bug fix, CPATH="" does not add '.' to search path.
llvm-svn: 57072
2008-10-04 20:58:18 +00:00
Daniel Dunbar 921b968841 Add Parser support for #pragma pack
- Uses Action::ActOnPragmaPack
 - Test case is XFAIL pending verifier fixes.

llvm-svn: 57066
2008-10-04 19:21:03 +00:00
Daniel Dunbar 405965323d Add Preprocessor::RemovePragmaHandler.
- No functionality change.

llvm-svn: 57065
2008-10-04 19:17:46 +00:00
Ted Kremenek 5ca90a244f This is a big patch, but the functionality change is small and the rest of the patch consists of deltas due to API changes.
This patch overhauls the "memory region" abstraction that was prototyped (but never really used) as part of the Store.h.  This patch adds MemRegion.h and MemRegion.cpp, which defines the class MemRegion and its subclasses.  This classes serve to define an abstract representation of memory, with regions being layered on other regions to to capture the relationships between fields and variables, variables and the address space they are allocated in, and so on.  

The main motivation of this patch is that key parts of the analyzer assumed that all value bindings were to VarDecls.  In the future this won't be the case, and this patch removes lval::DeclVal and replaces it with lval::MemRegionVal.  Now all pieces of the analyzer must reason about abstract memory blocks instead of just variables.

There should be no functionality change from this patch, but it opens the door for significant improvements to the analyzer such as field-sensitivity and object-sensitivity, both which were on hold until the memory abstraction got generalized.

The memory region abstraction also allows type-information to literally be affixed to a memory region.  This will allow the some now redundant logic to be removed from the retain/release checker.

llvm-svn: 57042
2008-10-04 05:50:14 +00:00
Zhongxing Xu 8d1928a4ca Reverse the RHSBlock of LogicalOp && and ||
llvm-svn: 57041
2008-10-04 05:48:38 +00:00
Chris Lattner 7c306a70b9 add a new Rewriter::getRewritenText method that returns the text for a range
that includes any edits in the range.

llvm-svn: 57037
2008-10-03 23:31:16 +00:00
Daniel Dunbar 325601a9e5 Merge postfix attributes on record decls.
llvm-svn: 57019
2008-10-03 17:33:35 +00:00
Daniel Dunbar e4ac7a4059 Remove a FIXME.
llvm-svn: 57015
2008-10-03 16:42:10 +00:00
Daniel Dunbar 4d601119c3 Pass postfix attributes to ActOnFields (mismarked a file).
llvm-svn: 56993
2008-10-03 02:05:12 +00:00
Daniel Dunbar 15619c7e4b Pass postfix attributes to ActOnFields.
llvm-svn: 56992
2008-10-03 02:03:53 +00:00
Steve Naroff 2231569f01 Add getTypeSpecStartLoc() to VarDecls and FunctionDecls.
This is a temporary solution to help with the block rewriter (though it certainly has general utility).
Once DeclGroup's are implemented, this SourceLocation should be stored with it (since it applies to all the decls).

llvm-svn: 56985
2008-10-03 00:02:03 +00:00
Daniel Dunbar dc2ab1740a Add Builtins.def attribute for "can be a constant expression".
- Enabled for builtins which are always constant expressions
   (__builtin_huge_val*, __builtin_inf*, __builtin_constant_p,
   __builtin_classify_type, __builtin___CFStringMakeConstantString).

Added Builtin::Context::isConstantExpr.
 - Currently overly simply interface which only works for builtins
   whose constantexprness does not depend on their arguments.

CallExpr::isBuiltinConstantExpr now takes an ASTContext argument.

llvm-svn: 56983
2008-10-02 23:30:31 +00:00
Daniel Dunbar dd9b2d16f9 Add support for format string checking of object-size checking
versions of sprintf and friends.
 - Added FIXME that this mechanism should be generalized.

llvm-svn: 56962
2008-10-02 18:44:07 +00:00
Daniel Dunbar e23f28f8a5 Emit error unsupported for break/continue/goto inside Obj-C exception
handling blocks.
 - This has false positives, but at least prevents miscompiles.

llvm-svn: 56958
2008-10-02 18:02:06 +00:00
Steve Naroff d40a39626c Changed Sema::CheckForConstantInitializer to allow global block literals.
This commit also includes some name changes in the blocks rewriter (no functionality change).

llvm-svn: 56955
2008-10-02 17:12:56 +00:00
Daniel Dunbar c3d16493ae (LLVM up) Rename IRBuilder::IsNonNull -> IsNotNull.
llvm-svn: 56954
2008-10-02 17:05:36 +00:00
Ted Kremenek 3aa89a971d Enhance NSError** checking with analogous checking for CFErrorRef*.
Expand checking to include functions, not just methods.

llvm-svn: 56938
2008-10-01 23:24:09 +00:00
Ted Kremenek 8dcd40768e Use LVal::IsLValType(T) instead of checking to see if the type is an "lvalue" type directly.
llvm-svn: 56912
2008-10-01 05:02:13 +00:00
Daniel Dunbar fbe68a84f8 NeXT: Update to use CreateRuntimeFunction for the routines it imports.
llvm-svn: 56902
2008-10-01 01:06:06 +00:00
Daniel Dunbar 23fd462f48 Add simple interface for protecting runtime functions from name
collisions.
 - Provide CodeGenModule::CreateRuntimeFunction which guarantees that
   the function it creates will have the provided name in the final
   module. This allows the runtime to have its functions protected
   from declarations of the same name in the source code.

 - One could argue that this is a reason to abuse the llvm::Module
   namespace for dealing with function redeclarations. However, that
   approach seems conceptually flawed to me. This one also happens to
   be somewhat more efficient.

No functionality change.

llvm-svn: 56899
2008-10-01 00:49:24 +00:00
Ted Kremenek d331d09e2f Add a QualType to ConjuredSymbol to represent the type and size of the symbol.
Use this updated interface when invalidating arguments passed by reference; the type of symbol is of the object passed by reference, not the reference itself.

llvm-svn: 56894
2008-10-01 00:21:14 +00:00
Chris Lattner a1cf5f9663 simplify padding, just fold it into the earlier resize.
llvm-svn: 56880
2008-09-30 20:53:45 +00:00
Chris Lattner 8b567f9713 fix a potential buffer overrun that Eli noticed
llvm-svn: 56879
2008-09-30 20:51:14 +00:00
Chris Lattner 59f09b6fe1 Document assumptions that NumericLiteralParser makes with an assertion.
llvm-svn: 56876
2008-09-30 20:45:40 +00:00
Chris Lattner 97d749464d Handle minor version numbers in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
like "10.3.9"

llvm-svn: 56873
2008-09-30 20:30:12 +00:00
Daniel Dunbar 5f57710392 Add diagnostic for .{lo,hi,e,o} on odd-sized extended vectors.
llvm-svn: 56859
2008-09-30 17:22:47 +00:00
Steve Naroff 4a82d815de Fix <rdar://problem/6191148> [sema] Objective-C method lookup (at global scope) fails to handle overloaded selectors properly.
Long standing bug in Sema::ActOnInstanceMessage(). We now warn when messaging an "id" with multiple method signatures in scope. The diags are a little verbose, however they can be streamlined if necessary. 

llvm-svn: 56843
2008-09-30 14:38:43 +00:00
Steve Naroff 9f9774cd2b Improved fix for <rdar://problem/6247781> Parser rejecting properly mismatched properties.
Needed to make sure the relaxed type checking only applies to "readonly" properties.

llvm-svn: 56838
2008-09-30 10:07:56 +00:00
Nick Lewycky e275a66538 Add missing include for use of atoi.
llvm-svn: 56836
2008-09-30 07:18:57 +00:00
Ted Kremenek f1b299952a Revert last patch, but add a fixme
llvm-svn: 56832
2008-09-30 05:35:42 +00:00
Ted Kremenek 76bccf6221 Within the transfer function of UnaryOperatorExpr, handle implicit promotions
from the subexpression type to the expression type.

llvm-svn: 56831
2008-09-30 05:32:44 +00:00
Mon P Wang 553b4b912b Added support for sse intrinsics loadlpd, loadhpd, muldq128, and mulld128
llvm-svn: 56830
2008-09-30 05:31:27 +00:00
Daniel Dunbar 2efd538f61 Add infrastructure for proper @finally support.
- Provides a basic primitive to jump to an arbitrary basic block,
   through the finally code.

 - Only used for return statements and rethrow currently. Still need
   to handle break, continue and goto.

 - Code still needs to be shuffled around to live elsewhere.

llvm-svn: 56827
2008-09-30 01:06:03 +00:00
Chris Lattner b3793bb415 The definition of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ follows
the target triple on darwin.  For example i386-apple-darwin9 -> 1050 because
darwin9 is "10.5".

llvm-svn: 56826
2008-09-30 01:00:25 +00:00