Sebastian Redl
61364dddc3
Convert a number of statement parsers to smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 19:30:53 +00:00
Douglas Gregor
a4c46df1cd
Actually distinguish between RecordDecl::field_iterator and RecordDecl::field_const_iterator, propagating the constness down to the FieldDecls.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60883 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 17:59:21 +00:00
Douglas Gregor
44b4321fea
Unifies the name-lookup mechanisms used in various parts of the AST
...
and separates lexical name lookup from qualified name lookup. In
particular:
* Make DeclContext the central data structure for storing and
looking up declarations within existing declarations, e.g., members
of structs/unions/classes, enumerators in C++0x enums, members of
C++ namespaces, and (later) members of Objective-C
interfaces/implementations. DeclContext uses a lazily-constructed
data structure optimized for fast lookup (array for small contexts,
hash table for larger contexts).
* Implement C++ qualified name lookup in terms of lookup into
DeclContext.
* Implement C++ unqualified name lookup in terms of
qualified+unqualified name lookup (since unqualified lookup is not
purely lexical in C++!)
* Limit the use of the chains of declarations stored in
IdentifierInfo to those names declared lexically.
* Eliminate CXXFieldDecl, collapsing its behavior into
FieldDecl. (FieldDecl is now a ScopedDecl).
* Make RecordDecl into a DeclContext and eliminates its
Members/NumMembers fields (since one can just iterate through the
DeclContext to get the fields).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 16:49:14 +00:00
Zhongxing Xu
c5458622a3
Identify AnonPointeeRegion by the symbol that is concretized.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 09:08:46 +00:00
Zhongxing Xu
3bb662a863
AnonPointeeRegions are now identified by the MemRegion of the pointer pointing
...
to them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60868 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 02:27:34 +00:00
Anders Carlsson
5b1f3f0b21
Make sure to promote expressions of the form (floating point + complex integer) correctly, to (complex floating point + complex floating point)
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 23:30:05 +00:00
Ted Kremenek
bc0f6bc039
PreprocessorLexer (and subclasses):
...
- Added virtual method 'getSourceLocation()' (no arguments) that gets the location of the next "observable" location (e.g., next character, next token).
PPLexerChange.cpp:
- Implemented FIXME by using PreprocessorLexer::getSourceLocation() to get the location in the file we are returning to after lexing a #included file. This appears to be slightly faster than having the branch (i.e., 'if(CurLexer)'). It's also not a really hot part of the Preprocessor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60860 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 23:20:59 +00:00
Douglas Gregor
caaf29a087
Added a warning when referencing an if's condition variable in the
...
"else" clause, e.g.,
if (int X = foo()) {
} else {
if (X) { // warning: X is always zero in this context
}
}
Fixes rdar://6425550 and lets me think about something other than
DeclContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60858 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 23:01:14 +00:00
Steve Naroff
bc76dd06eb
The "real" fix for <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
...
Commit r60845 was premature.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60852 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 22:14:21 +00:00
Douglas Gregor
2988205cb3
Fix PR clang/3175: CheckAddressOfOperand does not handle references to class vars
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 21:26:49 +00:00
Douglas Gregor
83f96f668d
Some cleanups to the dependent-types commit, as suggested by Sebastian
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60848 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 20:57:37 +00:00
Steve Naroff
4e78fd0a96
Fix <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 20:07:25 +00:00
Ted Kremenek
cf58e6249c
Declare PerIDCache as IdentifierInfo** instead of void*. This is just cleaner. No performance change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 19:40:23 +00:00
Steve Naroff
c0febd58f5
Fix <rdar://problem/6418623> Bogus block type compatibility warning.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 17:49:55 +00:00
Douglas Gregor
8935b8b490
Use a scoped object to manage entry/exit from a parser scope rather than explicitly calling EnterScope/ExitScope
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 06:34:36 +00:00
Anders Carlsson
565c99f45e
Append an extra newline to the module inline asm if it's not empty.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 02:21:04 +00:00
Fariborz Jahanian
391d895370
Patch to allow a getter call using property dot-syntax notation.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60816 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:21:50 +00:00
Sebastian Redl
effa8d1c97
Modify the move emulation according to the excellent design of Howard Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:02:53 +00:00
Ted Kremenek
1d6c14bd27
Fix to BasicStoreManager::getElementLValue: If the base region is a symbol, layer an AnonTypedRegion on top of it.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 23:50:57 +00:00
Fariborz Jahanian
91b51a92f2
Prevent bogus warning on unimplemented setter/getter when user
...
has added declaration of these methods in its @interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:43:22 +00:00
Ted Kremenek
7d71b296c7
Have BasicStoreManager::getLValueElement() have logic similar to BasicStoreManager::getLValueField() (i.e., don't just return the 'base' as the SVal)
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 21:20:27 +00:00
Fariborz Jahanian
fef30b5523
Support for implementation of property in the case where
...
the synthesis is in an implementation of s subclass of
a super class where the property has been declared.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 20:23:04 +00:00
Sebastian Redl
15faa7fdfb
Kick out the proof-of-concept ASTOwner and replace it with ASTOwningResult
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 20:22:58 +00:00
Ted Kremenek
2fda504dcc
Add preliminary CFG support for @throw. We basically treat it like a return statement.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 20:20:09 +00:00
Ted Kremenek
bbfd07a0c9
In GRExprEngine treat @throw as an 'abort' that ends the current path. This is a temporary solution.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60789 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 20:18:58 +00:00
Sebastian Redl
7f792faf0c
Lay the groundwork for converting the entire parser-sema chain to smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:36:21 +00:00
Steve Naroff
6082c62125
Sema::ActOnMethodDeclaration(): Make sure we perform the default function/array conversion for parameter types.
...
This fixes <rdar://problem/6424064> checker on xcode: (possible bad AST) can the type of a method parameter really have "isFunctionType() == true"?
and http://llvm.org/bugs/show_bug.cgi?id=2997 .
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:36:17 +00:00
Chris Lattner
c9f29c6185
Fix a serious null termination bug found by David Chisnall!
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:10:54 +00:00
Sebastian Redl
0e9eabca26
Consistently use smart pointers for stmt and expr nodes in parser local variables.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 13:15:23 +00:00
Zhongxing Xu
2fdf555af1
Add utility method. Remove an unused method.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60758 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 10:51:19 +00:00
Ted Kremenek
159d2487e6
[static analyzer] Extend VLA size checking to look for undefined sizes.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 00:44:16 +00:00
Ted Kremenek
e0dbda1364
Fixed LiveVariables bug where we didn't consider block-level expressions that functioned as the size of a VLA to be live.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60730 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 00:14:14 +00:00
Fariborz Jahanian
447d7aeb94
Change condition under which 'retain'/'copy' are directly evaluated.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60729 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 23:56:17 +00:00
Ted Kremenek
efd5994d6a
Add checking for zero-sized VLAs.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60726 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 22:47:34 +00:00
Chris Lattner
90b93d6f69
Fix PR3172: if we see an eof or } at the top level, reject it.
...
This is important because ParseDeclarationOrFunctionDefinition
skips to, but does not consume, an } on error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60719 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 21:59:01 +00:00
Chris Lattner
891dca671a
improve comment.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60718 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 21:53:24 +00:00
Ted Kremenek
2c615660ec
'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'. This fixes <rdar://problem/6380411>.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60717 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 21:44:15 +00:00
Steve Naroff
b79c01ea32
ObjCInterfaceDecl::lookupInstanceMethod() needs to look through a categories protocols.
...
Fixes <rdar://problem/6418640> clang on prokit: error: incompatible type returning 'id', expected 'NSSize'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 20:57:28 +00:00
Fariborz Jahanian
ba45da8328
Changed 'readonly' 'retain/copy' diagnostics into
...
warning as it is allowed in gcc and will break projects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 19:28:10 +00:00
Fariborz Jahanian
9bfb2a2cbe
Since we do not allow a readonly property to be 'copy'retain', we
...
must allow the continuation class to extend it to a 'readwrite'
and 'copy/retain'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 18:47:29 +00:00
Douglas Gregor
f57172b24f
Move Sema::isTemplateParameterDecl to Decl::isTemplateParameter, where it belongs
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 18:40:42 +00:00
Zhongxing Xu
e50897af8b
fix 80-col violation.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:14:51 +00:00
Zhongxing Xu
00c028b4a1
fix typo.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 05:12:38 +00:00
Eli Friedman
e9a0f43927
Workaround for PR3173. The fix is correct in the sense that if the enum
...
code were working correctly, it would be a no-op, but it's not really a
proper fix. That said, I don't really want to touch the enum code at
the moment because I don't understand it very well, and this seems to
be a relatively visible regression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 02:21:03 +00:00
Nuno Lopes
a3d783b11f
add missing gentoo c++ include paths
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 12:11:37 +00:00
Anders Carlsson
7fd1df2a87
Pass the VLA size expr range to the VLA diags
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:49:48 +00:00
Anders Carlsson
96e05bc090
Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60638 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:20:55 +00:00
Fariborz Jahanian
5dd4129011
Setters returning a typedef of 'void' should not cause error.
...
Bug reported by Chris L.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 23:12:49 +00:00
Fariborz Jahanian
1ac2bc4478
Use of properties declared in protocols in the category
...
via the category's protocol list1s, with appropriate
diagnsostics and a test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60634 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 23:03:39 +00:00
Fariborz Jahanian
196d0ed5e1
Improve error reporting of property and setter/getter
...
type mimatches.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60630 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 21:48:16 +00:00