Zhongxing Xu [Sat, 15 Aug 2009 03:17:38 +0000 (03:17 +0000)]
Extend the ProgramPoint to include the context information LocationContext,
which is either a stack frame context of the function or a local scope
context.
Eli Friedman [Sat, 15 Aug 2009 02:50:32 +0000 (02:50 +0000)]
Fix for PR4721: adjust CodeGen and ASTContext so that we have a
consistent model for handling size expressions for VLAs.
The model is essentially as follows: VLA types own their associated
expression. In some cases, we need to create multiple VLA types to
represent a given VLA (for canonical types, or qualifiers on array types,
or type merging). If we need to create multiple types based off of
the same VLA declaration, we use the new refcounting functionality so they can
all own the expression. The VLASizeMap in CodeGenFunction then uses the size
expression to identify the group of VLA types based off of the same original
declaration.
I'm not particularly attached to the VLA types owning the expression,
but we're stuck with at least until someone comes up with a way
to walk the VLA expressions for a declaration.
I did the parallel fix in ASTContext for DependentSizedArrayType, but I
haven't really looked closely at it, so there might still be issues
there.
I'll clean up the code duplication in ASTContext in a followup commit.
Ted Kremenek [Sat, 15 Aug 2009 00:51:46 +0000 (00:51 +0000)]
Change handling of attribute 'malloc' to only accept the attribute on function
declarations (and not function pointers). This is consistent with GCC. Accepting
this attribute on function pointers means that the attribute should be treated
as a type qualifier, which apparently is not what GCC does. We obviously can
change this later should we desire to enhance the 'malloc' attribute in this
way.
Ted Kremenek [Fri, 14 Aug 2009 20:49:40 +0000 (20:49 +0000)]
Improve Sema's handling of attribute 'malloc' to reject the attribute when
attaching to Objective-C methods (which mirrors GCC's behavior) and to allow the
return type of the function to be an Objective-C pointer or Block pointer (which
GCC also accepts).
Along the way, add 'const' to some of the pointer arguments of various utility
functions...
Fixed a bug in ir-gen for copy assignment synthesis.
Fixed a bug when evaluating those copy-assignments
which need by lazily syntheized. A test case
for these.
Patch to force synthesis of copy assignment operator
function in the order according to c++03. ir-gen
for copy assignment in the trivial case and the first
test case.
John McCall [Tue, 11 Aug 2009 06:59:38 +0000 (06:59 +0000)]
Argument-dependent lookup for friend declarations. Add a new decl type,
FriendFunctionDecl, and create instances as appropriate.
The design of FriendFunctionDecl is still somewhat up in the air; you can
befriend arbitrary types of functions --- methods, constructors, etc. ---
and it's not clear that this representation captures that very well.
We'll have a better picture when we start consuming this data in access
control.
Douglas Gregor [Tue, 11 Aug 2009 05:31:07 +0000 (05:31 +0000)]
Refactor the template-instantiation logic for expressions into a
generic tree transformation (also used for recanonicalization) and a
small amount of template-instantiation-specific logic.
Mike Stump [Tue, 11 Aug 2009 04:03:59 +0000 (04:03 +0000)]
Implement more of the inductive case for vtable layout involving
virtual base primaries and improve the layout of classes with virtual
bases. WIP.
Hey, I've decided I want a change to FileCheck, I need to ensure that
the group is together, nothing in between. Can we change it to check
the match line is from the line immediately following the last matched
line, if the source for the matched line is immediately after the
source for the previously matched line?
// CHECK: 1
// CHECK: 2
// CHECK: 3
// CHECK: 4
// CHECK: 5
// CHECK: 6
would require 1 2 and 3 to be continuous in the output, and 4 5 and 6
to be continuous.
Nate Begeman [Mon, 10 Aug 2009 23:49:36 +0000 (23:49 +0000)]
Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems
Addresses Eli's patch feedback re: ugly cast code
Updates all postfix operators to remove ParenListExprs. While this is awful,
no better solution (say, in the parser) is obvious to me. Better solutions
welcome.
Anders Carlsson [Mon, 10 Aug 2009 21:30:22 +0000 (21:30 +0000)]
Add a CastInfo struct that will be used for cast information when constructing cast expressions. Right now it only stores the cast kind, but in the future it might store conversion functions and constructors.
Chris Lattner [Mon, 10 Aug 2009 19:03:04 +0000 (19:03 +0000)]
fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
"argument to annotate attribute was not a string literal"
make it say "section attribute" instead.
2. Fix the location of the above message to point to the
bad argument instead of the section token.
3. Implement rdar://4341926, by diagnosing invalid section
specifiers in the frontend rather than letting them slip all
the way to the assembler (a QoI win).
An example of #3 is that we used to produce something like this:
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).
Daniel improved clang to use llvm_report_error, so now we got:
$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
requires a segment and section separated by a comma.
with no loc info. Now we get:
$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
and section separated by a comma
int x __attribute__((section("sadf")));
^
Daniel Dunbar [Mon, 10 Aug 2009 03:40:28 +0000 (03:40 +0000)]
Use LLVM's new error handler API to report back end errors using Diagnostic.
For example,
--
ddunbar@giles:Frontend$ clang -c backend-errors.c
fatal error: error in backend: Global variable 'a' has an invalid section specifier
'I AM, not, legal': mach-o section specifier uses an unknown section type.
--
compare to:
--
ddunbar@giles:Frontend$ gcc -c backend-errors.c
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Expected comma after segment-name
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest of line ignored. 1st junk character valued 77 (M).
--
Yay!
I am not tied to my wording choice, we could also go with "uncoverable error"
for the prefix, or just leave it off entirely.
Daniel Dunbar [Mon, 10 Aug 2009 03:01:36 +0000 (03:01 +0000)]
Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D test/Sema/altivec-init.c
U include/clang/Basic/DiagnosticSemaKinds.td
U include/clang/AST/Expr.h
U include/clang/AST/StmtNodes.def
U include/clang/Parse/Parser.h
U include/clang/Parse/Action.h
U tools/clang-cc/clang-cc.cpp
U lib/Frontend/PrintParserCallbacks.cpp
U lib/CodeGen/CGExprScalar.cpp
U lib/Sema/SemaInit.cpp
U lib/Sema/Sema.h
U lib/Sema/SemaExpr.cpp
U lib/Sema/SemaTemplateInstantiateExpr.cpp
U lib/AST/StmtProfile.cpp
U lib/AST/Expr.cpp
U lib/AST/StmtPrinter.cpp
U lib/Parse/ParseExpr.cpp
U lib/Parse/ParseExprCXX.cpp
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.