Chris Lattner
b22f1c8bf7
refactor the autosizing code, eliminating duplication
...
and making Get8ByteTypeAtOffset always succeed and documented.
llvm-svn: 109685
2010-07-28 22:44:07 +00:00
Douglas Gregor
a9c3e82755
Don't die when a member access refers to a non-class member via a
...
qualified name. Fixes <rdar://problem/8231724>.
llvm-svn: 109682
2010-07-28 22:27:52 +00:00
Chris Lattner
4c1e484f39
fix PR7714 by not referencing off the end of a struct when passed by value in
...
x86-64 abi. This also improves codegen as well. Some refactoring is needed of
this code.
llvm-svn: 109681
2010-07-28 22:15:08 +00:00
Douglas Gregor
a5fd522992
Turn off precompiled preamble support for C++
...
llvm-svn: 109680
2010-07-28 22:12:37 +00:00
Douglas Gregor
85b5063f2c
When performing code completion for a case statement in a switch whose
...
condition is not of enumeration type, provide code-completion results
containing all values of integral or enumeral type.
llvm-svn: 109677
2010-07-28 21:50:18 +00:00
Sebastian Redl
04f5c31e98
Support extended vector types in chained PCH.
...
llvm-svn: 109675
2010-07-28 21:38:49 +00:00
Sebastian Redl
887d6b08fd
Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files.
...
llvm-svn: 109660
2010-07-28 21:07:02 +00:00
Fariborz Jahanian
d5010898ab
Fix flags in global block descriptor when
...
block returns structs. Fies radar 8241648.
Executable test added to llvm test suite.
llvm-svn: 109620
2010-07-28 19:07:18 +00:00
Chris Lattner
ff941a666a
some cleanups and get alignments correct for various coerce cases.
...
llvm-svn: 109607
2010-07-28 18:24:28 +00:00
Douglas Gregor
5dc055350e
The grammar for GNU typeof in C requires an expression to be
...
parenthesized, unlike in C++, e.g.,
C has: typeof ( expression)
C++ has: typeof unary-expression
So, once we've parsed a parenthesized expression after typeof, we
should only go on to parse the postfix expression suffix if we're in
C++. Fixes <rdar://problem/8237491>.
llvm-svn: 109606
2010-07-28 18:22:12 +00:00
Daniel Dunbar
b8068c33e2
Preprocessor: Add support for '#pragma clang __debug crash' and '#pragma clang
...
__debug overflow_stack'.
- For testing crash reporting stuff... you'd think I could just use some C++
code but Doug keeps fixing stuff!
llvm-svn: 109587
2010-07-28 15:40:33 +00:00
Douglas Gregor
bbfd2c0a86
Enable expression transformations in the current-instantiation
...
rebuilder, i.e., remove a silly short-sighted hack from long
ago. Thanks to Abramo Bagnara for the test case/bug report!
llvm-svn: 109583
2010-07-28 15:14:14 +00:00
Douglas Gregor
df65c8ed2a
When a nested-name-specifier refers into a current instantiation that has
...
dependent bases, construct a dependent nested-name-specifier rather
than complaining that the name could not be found within the current
instantiation itself. Fixes PR7725.
llvm-svn: 109582
2010-07-28 14:49:07 +00:00
Gabor Greif
79ac9ed7ac
we are not supposed to create an improper callsite using a CallInstr; leave a fixme mentioning the simplification when CallSite can clone itself
...
llvm-svn: 109575
2010-07-28 09:19:33 +00:00
Devang Patel
a652fab052
construct debug info for "id" by hand.
...
Tested by mi1-var-obj.exp in gdb testsuite.
llvm-svn: 109571
2010-07-28 01:33:15 +00:00
John McCall
ba80390307
When creating a jump destination, its scope should be the scope of the
...
enclosing normal cleanup, not the top of the EH stack. I'm *really*
surprised this hasn't been causing more problems.
Fixes rdar://problem/8231514.
llvm-svn: 109569
2010-07-28 01:07:35 +00:00
Tom Care
29a6250bf0
Added some false positive checking to UnreachableCodeChecker
...
- Allowed reporting of dead macros
- Added path walking function to search for false positives in conditional statements
- Updated some affected tests
- Added some false positive test cases
llvm-svn: 109561
2010-07-27 23:30:21 +00:00
Tom Care
76bdd685c2
Extracted out some useful common functions in IdempotentOperationChecker to their own CheckerHelpers file.
...
llvm-svn: 109560
2010-07-27 23:26:07 +00:00
Sebastian Redl
9891212476
Record macros in dependent PCHs. Also add various info tables to dependent PCHs; tests for this to follow.
...
llvm-svn: 109554
2010-07-27 23:01:28 +00:00
Argyrios Kyrtzidis
c0279a9826
Revert r109546, it broke linux build.
...
llvm-svn: 109550
2010-07-27 22:37:14 +00:00
Argyrios Kyrtzidis
4fac280618
Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
...
DeclIsRequiredFunctionOrFileScopedVar.
This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also
needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes.
This fixes current (and avoids future) codegen-from-PCH bugs.
llvm-svn: 109546
2010-07-27 22:01:17 +00:00
Eli Friedman
7530049b16
Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.
...
llvm-svn: 109537
2010-07-27 20:51:02 +00:00
Devang Patel
4f6e73b168
Always use current working directory for DW_AT_comp_dir.
...
llvm-svn: 109535
2010-07-27 20:49:59 +00:00
Eli Friedman
6b197e0651
PR7724: Don't try to evaluate value-dependent expressions.
...
llvm-svn: 109532
2010-07-27 19:14:53 +00:00
Ted Kremenek
83b598c14f
Finesse 'idempotent operations' analyzer issues to include the opcode of the binary operator for clearer error reporting. Also remove the 'Idempotent operation' prefix in messages; it's redundant since the bug type is the same.
...
llvm-svn: 109527
2010-07-27 18:49:08 +00:00
Sebastian Redl
4b1f490860
Update the list of lexical decls in the TU for chained PCHs. This makes -ast-print show the decls from the dependent PCH.
...
llvm-svn: 109524
2010-07-27 18:24:41 +00:00
Ted Kremenek
e5cc6a858a
Put 'Idempotent operations' static analyzer issues in the 'Dead code' category.
...
llvm-svn: 109517
2010-07-27 17:52:52 +00:00
Devang Patel
6014edd117
Reapply 109303.
...
llvm-svn: 109507
2010-07-27 15:17:16 +00:00
Douglas Gregor
96c042616e
Fix use-after-free with precompiled preambles
...
llvm-svn: 109505
2010-07-27 14:52:07 +00:00
Argyrios Kyrtzidis
76314d1ea8
Always deserialize from PCH file scoped variables with non trivial constructor/destructor.
...
Fixes http://llvm.org/PR7692
llvm-svn: 109501
2010-07-27 12:56:10 +00:00
Michael J. Spencer
2c35bc1232
Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format"
...
Got errors about ASTContext being undefined with Visual Studio 2010.
llvm-svn: 109491
2010-07-27 04:46:02 +00:00
Jordy Rose
55442abee6
Don't warn about unreachable code if the block starts with __builtin_unreachable().
...
The next step is to warn if a block labeled unreachable is, in fact, reachable. Somewhat related to PR810.
llvm-svn: 109487
2010-07-27 03:39:53 +00:00
Ted Kremenek
2bd41d1e30
Add PTHLexer::LexEndOfFile() to emit diagnostics at end-of-file similar to those by Lexer::LexEndOfFile().
...
llvm-svn: 109486
2010-07-27 02:59:02 +00:00
Ted Kremenek
fee882ac95
PTH generation: Don't save the leading '#' token in a null directive. This unbreaks using PTH with Boost (<rdar://problem/8227989>).
...
llvm-svn: 109484
2010-07-27 02:58:57 +00:00
Jordy Rose
b052e8f436
Groundwork for C string length tracking. Currently only handles the length of constant string literals, which is not too helpful, and only calls to strlen() are checked.
...
llvm-svn: 109480
2010-07-27 01:37:31 +00:00
Douglas Gregor
ce3a8293a0
Implement -fno-validate-pch at the -cc1 level, which suppresses most
...
of the usual consistency checks used to determine when a precompiled
header is incompatible with the translation unit it's being loaded
into.
Enable this option when loading a precompiled preamble, because the
preamble loader will be performing all of this checking itself. Enable
the preamble-based test now that it's working.
This option is also useful for debugging Clang's PCH
(<rdar://problem/7532213>).
llvm-svn: 109475
2010-07-27 00:27:13 +00:00
Sebastian Redl
66c5eef182
- Fix recording of offsets of types in dependent PCHs.
...
- Stop reading in (and thus deserializing) every declaration in the TU when creating a dependent PCH.
- Switch the storage of a decl context's lexical declarations to a blob containing the IDs instead of a record. This is the only sane way of supporting update records later on.
llvm-svn: 109474
2010-07-27 00:17:23 +00:00
Douglas Gregor
81c000fb6d
When remapping a virtual file, also make an entry for the file with
...
its absolute path on disk. Also, introduce a fun test for the
precompiled preamble, which almost works...
llvm-svn: 109470
2010-07-26 23:54:23 +00:00
Fariborz Jahanian
0ebca28f1d
2nd argument of __builtin_expect must be evaluated
...
if it hs side-effect to matchgcc's behaviour.
Addresses radar 8172109.
llvm-svn: 109467
2010-07-26 23:11:03 +00:00
John McCall
5cbe152ffc
Test for the presence of EH branch-throughs instead of normal branch-throughs.
...
I knew this code duplication would bite me.
llvm-svn: 109463
2010-07-26 22:44:58 +00:00
Douglas Gregor
3f4bea0646
Introduce basic support for loading a precompiled preamble while
...
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.
It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).
As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.
llvm-svn: 109445
2010-07-26 21:36:20 +00:00
Dan Gohman
4888f1a210
Minor code simplification.
...
llvm-svn: 109443
2010-07-26 21:33:22 +00:00
Dan Gohman
0eb9c124a7
It's not necessary to call flush() on a raw_ostream immediately prior
...
to deleting it.
llvm-svn: 109441
2010-07-26 21:29:50 +00:00
Dan Gohman
28ade550f4
Fix namespace polution.
...
llvm-svn: 109440
2010-07-26 21:25:24 +00:00
Ted Kremenek
df4472bca0
Hoist argument type checking into CheckFormatHandler. This is prep for scanf format
...
string argument type checking.
llvm-svn: 109428
2010-07-26 19:45:54 +00:00
Ted Kremenek
6adb7e35ab
Consolidate #args checking for scanf/printf format strings.
...
llvm-svn: 109427
2010-07-26 19:45:42 +00:00
Devang Patel
6005082354
Revert 109303.
...
llvm-svn: 109426
2010-07-26 18:49:27 +00:00
Sebastian Redl
ae8cbb7220
Make sure that implicit qualification and derived-to-base conversions of xvalues preserve xvalue-ness. Unfortunately I have no idea how to test this property; there doesn't seem to be a syntactical construct that triggers such a conversion and still allows the distinction between prvalues and xvalues to be made.
...
llvm-svn: 109406
2010-07-26 17:52:21 +00:00
Nick Lewycky
19b9f958e1
Add source location information to C++ base specifiers.
...
llvm-svn: 109396
2010-07-26 16:56:01 +00:00
Douglas Gregor
67ca40c419
Eliminate the "minimal" and printing parser actions, which only ever
...
worked for C anyway. Also kills the -cc1 options -parse-noop and
-parse-print-callbacks.
llvm-svn: 109392
2010-07-26 04:08:02 +00:00
Benjamin Kramer
f5c4b49278
Wrap bit mangling logic for DiagMappings in its own class so it doesn't leak
...
into other code. Make it an array instead of a constant-length vector.
llvm-svn: 109384
2010-07-25 21:40:48 +00:00
Douglas Gregor
29b8e3d91c
Remove a bunch of trivial destructors
...
llvm-svn: 109382
2010-07-25 18:44:37 +00:00
Douglas Gregor
5a9310cfb9
Move Type destructor out-of-line
...
llvm-svn: 109381
2010-07-25 18:39:40 +00:00
Douglas Gregor
9c832f75c0
Remove destructors from declaration nodes
...
llvm-svn: 109380
2010-07-25 18:38:02 +00:00
Douglas Gregor
717ceeae76
I lied. Kill off a few more Destroy methods
...
llvm-svn: 109379
2010-07-25 18:32:30 +00:00
Douglas Gregor
a9b2dbc1a4
Kill off the last Destroy method in the AST library
...
llvm-svn: 109378
2010-07-25 18:23:53 +00:00
Douglas Gregor
b412e174db
Remove the vast majority of the Destroy methods from the AST library,
...
since we aren't going to be calling them ever.
llvm-svn: 109377
2010-07-25 18:17:45 +00:00
Douglas Gregor
5b11d49a7c
Make ASTContext always use the BumpPtrAllocator.
...
llvm-svn: 109375
2010-07-25 17:53:33 +00:00
Nick Lewycky
e602efc6f6
Remove emacs file mode marker on file with .cpp extension.
...
llvm-svn: 109366
2010-07-25 03:12:58 +00:00
Eli Friedman
e4686d7acf
Remove dead code.
...
llvm-svn: 109358
2010-07-24 21:35:09 +00:00
Nick Lewycky
84a11fdf57
Add header searching for llvm-gcc trunk on Gentoo AMD64. Patch by Mark Wood!
...
llvm-svn: 109357
2010-07-24 21:33:13 +00:00
Eli Friedman
9255adfb7a
PR7698: Make sure we correctly handle the initialization of an array with
...
dependent size.
llvm-svn: 109356
2010-07-24 21:19:15 +00:00
John McCall
268b576b72
Mangle enum constant expressions. Fixes rdar://problem/8204122
...
llvm-svn: 109315
2010-07-24 01:17:35 +00:00
Chris Lattner
938533db60
turn down the logical bitwise confusion warning to not warn
...
when the RHS of the ||/&& is ever 0 or 1. This handles a variety of
creative idioms for "true" used in C programs and fixes many false
positives at the expense of a few false negatives. This fixes
rdar://8230351.
llvm-svn: 109314
2010-07-24 01:10:11 +00:00
Devang Patel
268ad093a7
Untangle filename/dirname confusion. Store constructed strings on the side. Avoid use of Path.makeAbsolute().
...
DW_TAG_compile_unit uses two attributes DW_AT_name and DW_AT_comp_dir. Their expected values are:
$ clang foo.c -g
DW_AT_name - foo.c
DW_AT_comp_dir - `pwd`
$ clang one/two/foo.c -g
DW_AT_name - one/two/foo.c
DW_AT_comp_dir - `pwd`
$ clang /tmp/one/foo.c -g
DW_AT_name - /tmp/one/foo.c
DW_AT_comp_dir - empty
llvm-svn: 109303
2010-07-24 00:59:16 +00:00
Douglas Gregor
f5275a8339
Put a newline at the end of the padded buffers used for the
...
precompiled preamble. This will suppress the -pedantic "no newline at
end of file" warning.
llvm-svn: 109301
2010-07-24 00:42:07 +00:00
Douglas Gregor
6481ef1f9c
Once we've built (or reused) a precompiled preamble, create the
...
appropriately-padded main file buffer (that has spaces in the extra
"reserved" space) and thread that buffer through to the parsing
function. This still does nothing.
llvm-svn: 109299
2010-07-24 00:38:13 +00:00
John McCall
2ca705eb13
Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
...
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.
llvm-svn: 109298
2010-07-24 00:37:23 +00:00
Fariborz Jahanian
72cdffa401
Return type of a setter call caused by
...
use of property-dot syntax using 'super' as receiver
is 'void'. This fixes a bug in generating correct
API for setter call. Fixes radar 8203426.
llvm-svn: 109297
2010-07-24 00:34:08 +00:00
Douglas Gregor
536f091f95
Be careful; even though we had a proper name at the beginning of
...
Sema::ActOnDeclarator doesn't mean that the Decl we ended up creating
has a useful name. <rdar://problem/8229910>
llvm-svn: 109296
2010-07-24 00:10:38 +00:00
Douglas Gregor
4dde74988e
Once we've built a precompiled preamble, keep track of the details of
...
that preamble (the preamble text, preamble file, reserved main file
size). Check these details when we try to rebuild the precompiled
preamble, and when nothing has changed, re-use the precompiled
preamble.
This code is still very much a WIP, and can't even properly be tested
because we have no way to use the precompiled preamble yet. "Trust me"
llvm-svn: 109294
2010-07-23 23:58:40 +00:00
Sebastian Redl
ff4a2951d9
Make declarations in the dependent PCH visible, for C at least.
...
llvm-svn: 109292
2010-07-23 23:49:55 +00:00
Tom Care
cba9f517ac
Added an path-sensitive unreachable code checker to the experimental analyzer checks.
...
- Created a new class to do post-analysis
- Updated several test cases with unreachable code to expect a warning
- Added some general tests
llvm-svn: 109286
2010-07-23 23:04:53 +00:00
Devang Patel
cb9fe9ec16
Revert r109263.
...
llvm-svn: 109284
2010-07-23 23:04:28 +00:00
John McCall
dd762d1e5b
We never want to pop the translation unit DC, so assert if this happens.
...
llvm-svn: 109280
2010-07-23 22:45:07 +00:00
John McCall
ad5d61e227
Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
...
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.
llvm-svn: 109274
2010-07-23 21:56:41 +00:00
Fariborz Jahanian
946274471d
Allow __func__ and __FUNCTION__ and __PRETTY_FUNCTION__ inside blocks.
...
Radar 8218839.
llvm-svn: 109272
2010-07-23 21:53:24 +00:00
Devang Patel
28f167699a
There is no need to use separate dir name for AT_comp_dir attribute. Using absolute path for filename allows clients to query complete file location info from gdb breakpoints. Save constructed full file name.
...
llvm-svn: 109263
2010-07-23 20:38:37 +00:00
Eli Friedman
d4c75cddde
Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;
...
fixes crashes on both valid and invalid code. The diagnostic here could
potentially be improved, but it's good enough as-is.
llvm-svn: 109257
2010-07-23 19:25:41 +00:00
Fariborz Jahanian
c51609a0b5
PCH read/write for selector reference pool.
...
Finishes off radar 6507158.
llvm-svn: 109256
2010-07-23 19:11:11 +00:00
Douglas Gregor
5cc2c8b9c3
Vectors are not integer types, so the type system should not classify
...
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.
Patch from Anton Yartsev!
llvm-svn: 109229
2010-07-23 15:58:24 +00:00
Zhongxing Xu
5e6ef6d957
Add FILE* leak check to StreamChecker. Patch by Lei Zhang.
...
llvm-svn: 109225
2010-07-23 14:14:59 +00:00
Bill Wendling
8abd1ca8d2
Remove unneeded iostream include.
...
llvm-svn: 109219
2010-07-23 07:19:31 +00:00
Zhongxing Xu
73ede01cad
Change arg type.
...
llvm-svn: 109218
2010-07-23 05:55:01 +00:00
Zhongxing Xu
692ac46a70
Delete unnecessary const_cast.
...
llvm-svn: 109211
2010-07-23 02:54:53 +00:00
Zhongxing Xu
cabfb72654
AnalysisContext is not const.
...
llvm-svn: 109210
2010-07-23 02:49:07 +00:00
Zhongxing Xu
318e40360d
Fix build on Ubuntu 10.04.
...
llvm-svn: 109208
2010-07-23 02:15:08 +00:00
Douglas Gregor
be2d8c6096
Basic plumbing for generating a precompiled preamble for an
...
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.
llvm-svn: 109202
2010-07-23 00:33:23 +00:00
Fariborz Jahanian
86151343b4
Warn when property ivar lookup finds a global variable
...
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning. Radar 8225011.
llvm-svn: 109197
2010-07-22 23:33:21 +00:00
Sebastian Redl
c67764eb4b
Thread bitstream cursors all the way through the AST reading stuff. This way, reading a trivial 2-element chained file actually works.
...
llvm-svn: 109191
2010-07-22 22:43:28 +00:00
Devang Patel
0884a60eb5
Keep track of artificial scopes introduced by line directives. For example,
...
#line 41 "bar.c"
dummy (1, i);
#line 24 "bar.h"
i = f2 (i);
#line 44 "bar.c"
This is tested by step-line.exp in gdb testsuite.
llvm-svn: 109189
2010-07-22 22:29:16 +00:00
John McCall
775f9f9919
Turn off EH cleanups for __block variables; they caused some internal buildbot
...
failures. There's a radar tracking this.
llvm-svn: 109170
2010-07-22 21:25:44 +00:00
Douglas Gregor
cd8bdd025f
Improve performance during cursor traversal when a region of interest
...
is present.
Rather than using clang_getCursorExtent(), which requires
us to lex the token at the ending position to determine its
length. Then, we'd be comparing [a, b) source ranges that cover the
characters in the range rather than the normal behavior for Clang's
source ranges, which covers the tokens in the range. However, relexing
causes us to read the source file (which may come from a precompiled
header), which is rather unfortunate and affects performance.
In the new scheme, we only use Clang-style source ranges that cover
the tokens in the range. At the entry points where this matters
(clang_annotateTokens, clang_getCursor), we make sure to move source
locations to the start of the token.
Addresses most of <rdar://problem/8049381>.
llvm-svn: 109134
2010-07-22 20:22:31 +00:00
Fariborz Jahanian
6e7e8cc19d
atch for implementation of objective-c's -Wselector
...
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.
llvm-svn: 109129
2010-07-22 18:24:20 +00:00
Argyrios Kyrtzidis
2d8891cd5d
Read/write C++0x static_assert for PCH.
...
llvm-svn: 109123
2010-07-22 17:28:12 +00:00
Sebastian Redl
5c415f3e32
Allow loading declcontext information from any file in the chain. Properly write source locations to dependent files. WIP
...
llvm-svn: 109119
2010-07-22 17:01:13 +00:00
Argyrios Kyrtzidis
165b58181f
Read/write FriendTemplateDecl for PCH.
...
llvm-svn: 109113
2010-07-22 16:04:10 +00:00
Argyrios Kyrtzidis
47cd7a91f4
Support C++ try/catch statements for PCH.
...
llvm-svn: 109112
2010-07-22 16:03:56 +00:00
Zhongxing Xu
f0c133fe88
This patch adds support for tmpfile in StreamChecker. Patch by Lei Zhang.
...
llvm-svn: 109106
2010-07-22 14:01:01 +00:00
Zhongxing Xu
adf644d05e
Make a bunch of new data structures for the new analysis
...
engine of the new translation unit. State marshal is there but no real
work is done. End nodes are passed back.
llvm-svn: 109105
2010-07-22 13:52:13 +00:00