Commit Graph

24355 Commits

Author SHA1 Message Date
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
Douglas Gregor 45bd34a104 Make the pointer arguments to the __sync_* builtins pointers to
volatile-qualified types. Fixes <rdar://problem/8228293>.

llvm-svn: 109618
2010-07-28 18:42:27 +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
Tanya Lattner 5b46803955 Test commit
llvm-svn: 109604
2010-07-28 18:19:43 +00:00
Tanya Lattner 564798dfa9 Test commit.
llvm-svn: 109601
2010-07-28 18:08:38 +00:00
Ted Kremenek 2deaa98821 Update checker build.
llvm-svn: 109600
2010-07-28 17:44:21 +00:00
Chris Lattner 86e761052a accept and ignore a few more gcc warnings.
llvm-svn: 109591
2010-07-28 16:27:11 +00:00
Craig Silverstein 118c61c23e Add proper callbacks for DeclStmt -- we weren't recursing on
the decls.  This was just an oversight before; one we didn't
        catch because lots of information in a DeclStmt was also being
        traversed (redundantly) elsewhere.

        Once DeclStmt was cleaned up, I could clean up some of the
        redundant traversals found elswhere as well -- in particular,
        traversing the declarations inside a function as part of the
        function callback (instead of as part of the CompoundExpr
        callback that constitutes the body of the function).  The old
        way was really weird, and led to some parts of local variable
        declarations (but not all) being visited twice.  That is now
        resolved.  I also was able to simplify the traversers for
        IfStmt/WhileStmt/etc, which used to have redundant calls to
        work around the fact DeclStmt wasn't working properly.

        While in the area, I fixed up a few more recursion-ordering
        issues.  I try to hold to the principle that
        RecursiveASTVisitor visits objects in the source code in the
        same order they're typed.  So the return-type of a variable
        comes before the variable-name.  This still isn't perfect, but
        we're closer to that.

	Reviewed by chandlerc and wan.

llvm-svn: 109590
2010-07-28 15:54:33 +00:00
Daniel Dunbar 61854b193c Rename -Wlogical-bitwise-confusion to -Wconstant-logical-operand, which strikes
me as more consistent and less pejorative.

llvm-svn: 109588
2010-07-28 15:40:39 +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
Ted Kremenek 038abf7db0 Add PTH test case for <rdar://problem/8227989>.
llvm-svn: 109555
2010-07-27 23:06:03 +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
Eric Christopher 1de8562866 APIs that take different sized arguments than the instruction
should be taken out and shot.

llvm-svn: 109531
2010-07-27 19:11:16 +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
Ted Kremenek 162ab86d22 Add non-static version of BinaryOperator::getOpcodeStr().
llvm-svn: 109526
2010-07-27 18:49:04 +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 3d625eb2bf Fix predicate in 'InCachingLexMode' to include 'CurPTHLexer'.
llvm-svn: 109485
2010-07-27 02:58:59 +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