Chris Lattner
15ff1110c9
apply the new error recovery smarts we have for if's to while's and switch's.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 06:31:07 +00:00
Chris Lattner
a9053e02ce
rename recovery-3 to recovery.c
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60931 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 06:21:41 +00:00
Chris Lattner
0ba0dd6991
merge recovery-1 into recovery-3.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 06:21:18 +00:00
Chris Lattner
18914bcb22
merge recovery-2.c into recovery-3.c.
...
Substantially improve error recovery after broken if conditions by
parsing the full if when we have a semantic error instead of using
parser recovery techniques to recover from a semantic error.
This fixes rdar://6094870 - spurious error after invalid 'if' condition
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 06:19:11 +00:00
Chris Lattner
42ece6424f
minor refactoring of ParseParenExpression
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60928 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 06:00:12 +00:00
Chris Lattner
4209a3909d
add expected diag
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:59:56 +00:00
Chris Lattner
cf28702822
add ownership.h to xcode project
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60926 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:54:54 +00:00
Anders Carlsson
17d28a3e0b
Work in preparation for VLAs. Make sure to restore the stack if necessary (Saving the stack isn't implemented right now :)
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60925 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:52:00 +00:00
Chris Lattner
670a62cd1d
Fix rdar://6095061 - gcc allows __builtin_choose_expr as an lvalue
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:35:08 +00:00
Chris Lattner
f345accce0
Testcase for something that already works. Clang agrees with Comeau,
...
and this makes sense. likely a gcc bug that it doesn't diagnose the bad
restrict.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60923 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:25:55 +00:00
Chris Lattner
3534564044
add codegen support for __func__ and friends, producing the same
...
output that GCC does. rdar://6440297
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:18:02 +00:00
Chris Lattner
b0da923653
fix rdar://6097892 - gcc incompat: clang rejects __func__, __FUNCTION__, and __PRETTY_FUNCTION__ outside func
...
Yeah, this is "useful".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 05:05:20 +00:00
Chris Lattner
cd08707a96
Implement rdar://6138816 - [sema] named bitfields cannot have 0 width
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 04:56:04 +00:00
Douglas Gregor
c9467cf4cf
In C++, set the type of each of the enumerators in an enumeration to
...
the type of the enumeration once the enumeration has been defined.
Fix the overloading test-case to properly create enums that promote
the way we want them to.
Implement C++0x promotions from enumeration types to long
long/unsigned long long. We're using these promotions in Carbon.h
(since long long is a common extension).
Fixes PR clang/2954: http://llvm.org/bugs/show_bug.cgi?id=2954
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 02:00:36 +00:00
Ted Kremenek
fb645b6547
PTH:
...
- Added a side-table per each token-cached file with the preprocessor conditional stack. This tracks what #if's are matched with what #endifs and where their respective tokens are in the PTH file. This will allow for quick skipping of excluded conditional branches in the Preprocessor.
- Performance testing shows the addition of this information (without actually utilizing it) leads to no performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 23:36:38 +00:00
Chris Lattner
f62e14dae0
add annotation
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60907 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 23:11:52 +00:00
Sebastian Redl
20df9b7ab9
Convert a big bunch of expression parsers to use smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60906 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 22:51:44 +00:00
Ted Kremenek
cd223444d1
PTHLexer: Keep track of the location of the last '#' token and provide the means to jump ahead in the token stream.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60905 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 22:41:47 +00:00
Sebastian Redl
d8c4e15138
Convert some more expression parsers to use smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 22:33:27 +00:00
Sebastian Redl
2f7ece7c77
Convert selected expression parsers to use smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 21:36:32 +00:00
Steve Naroff
01f2ffacc4
Rename a local predicate to avoid confusion with Type::isBlockPointerType().
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 21:05:33 +00:00
Steve Naroff
47a2422088
Fixup generated code for imported block decl refs.
...
Found while investigating <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 20:51:38 +00:00
Douglas Gregor
e267ff35b2
Address some comments on the name lookup/DeclContext patch from Chris
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60897 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 20:41:00 +00:00
Ted Kremenek
7415326dcb
Remove unused ivar CurTokenIdx.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 20:39:48 +00:00
Sebastian Redl
43bc2a0973
Convert the remaining statement parsers to smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 20:12:42 +00:00
Sebastian Redl
9a92034270
Convert some more statement parsers to smart pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 19:48:14 +00:00
Steve Naroff
9fa72ef7e8
Fix <rdar://problem/6435842> clang ObjC rewriter: #include Block.h, Block_private.h or come up with #define to prevent double-definition
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 19:43:14 +00:00
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
Steve Naroff
f4312dc9b6
Fix <rdar://problem/6435382> clang ObjC rewriter: @property/@synthesize and blocks don't work together
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 19:29:16 +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
Ted Kremenek
83df2d2301
Updated checker build.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 00:20:13 +00:00
Anders Carlsson
5abfe2c236
Add another complex promotion test.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 23:57:51 +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
Steve Naroff
e58ee0ca7c
Fix regression caused by fixing <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 14:53:27 +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
Ted Kremenek
4dc506cbbc
Updated checker build.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:50:24 +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