Chris Lattner [Thu, 29 Jul 2010 04:41:05 +0000 (04:41 +0000)]
sink preferred type stuff lower. It's possible that this might
improve codegen for vaarg or something, because its codepath is
getting preferred types now.
Chris Lattner [Thu, 29 Jul 2010 02:31:05 +0000 (02:31 +0000)]
dissolve some more complexity: make the x86-64 abi lowering code
compute its own preferred types instead of having CGT compute
them then pass them (circuituously) down into ABIInfo.
Chris Lattner [Thu, 29 Jul 2010 02:16:43 +0000 (02:16 +0000)]
now that ABIInfo depends on CGT, it has trivial access to such
things as TargetData, ASTContext, LLVMContext etc. Stop passing
them through so many APIs.
Check for an invalid SourceLocation in clang_getCursor(). This avoids a possible assertion failure in SourceManager in the call to Lexer::GetBeginningOfToken(). Fixes <rdar://problem/8244873>.
Augment RegionStore::BindStruct() to bind symbolicated struct values. This fixes a false path issue reported in <rdar://problem/8243408> and also spurs another cause where the idempotent operations checker fires.
Douglas Gregor [Wed, 28 Jul 2010 23:59:57 +0000 (23:59 +0000)]
Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a
nested-name-specifier). Fixes <rdar://problem/8204126>.
Chris Lattner [Wed, 28 Jul 2010 23:47:21 +0000 (23:47 +0000)]
pass argument vectors in a type that corresponds to the user type if
possible. This improves the example to pass <4 x float> instead of
<2 x double> but we still get awful code, and still don't get the
return value right.
Chris Lattner [Wed, 28 Jul 2010 22:15:08 +0000 (22:15 +0000)]
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.
Douglas Gregor [Wed, 28 Jul 2010 21:50:18 +0000 (21:50 +0000)]
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.
Sebastian Redl [Wed, 28 Jul 2010 21:07:02 +0000 (21:07 +0000)]
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.
Douglas Gregor [Wed, 28 Jul 2010 18:22:12 +0000 (18:22 +0000)]
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>.
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.
Daniel Dunbar [Wed, 28 Jul 2010 15:40:33 +0000 (15:40 +0000)]
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!
Douglas Gregor [Wed, 28 Jul 2010 15:14:14 +0000 (15:14 +0000)]
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!
Douglas Gregor [Wed, 28 Jul 2010 14:49:07 +0000 (14:49 +0000)]
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.
John McCall [Wed, 28 Jul 2010 01:07:35 +0000 (01:07 +0000)]
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.
Tom Care [Tue, 27 Jul 2010 23:30:21 +0000 (23:30 +0000)]
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
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.
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.
Jordy Rose [Tue, 27 Jul 2010 01:37:31 +0000 (01:37 +0000)]
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.
Douglas Gregor [Tue, 27 Jul 2010 00:27:13 +0000 (00:27 +0000)]
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>).
Sebastian Redl [Tue, 27 Jul 2010 00:17:23 +0000 (00:17 +0000)]
- 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.
Douglas Gregor [Mon, 26 Jul 2010 23:54:23 +0000 (23:54 +0000)]
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...
Douglas Gregor [Mon, 26 Jul 2010 21:36:20 +0000 (21:36 +0000)]
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.
Sebastian Redl [Mon, 26 Jul 2010 17:52:21 +0000 (17:52 +0000)]
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.
Douglas Gregor [Mon, 26 Jul 2010 04:08:02 +0000 (04:08 +0000)]
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.
Douglas Gregor [Sun, 25 Jul 2010 17:39:21 +0000 (17:39 +0000)]
Start removing the use of smart pointers from the Parse/Sema
interaction, by effectively defaulting to
DISABLE_SMART_POINTERS. We're embracing the model where all AST nodes
are ASTContext-allocated and live as long as the ASTContext lives.