]> granicus.if.org Git - clang/log
clang
14 years agoWire up Daniel's new spiffy C interpreter into the CMake build system
Kovarththanan Rajaratnam [Sat, 27 Feb 2010 07:46:49 +0000 (07:46 +0000)]
Wire up Daniel's new spiffy C interpreter into the CMake build system

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97311 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd comment
Kovarththanan Rajaratnam [Sat, 27 Feb 2010 07:06:44 +0000 (07:06 +0000)]
Add comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97309 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd header + comments
Kovarththanan Rajaratnam [Sat, 27 Feb 2010 07:05:56 +0000 (07:05 +0000)]
Add header + comments

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97308 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix another vtable layout bug; we weren't looking hard enough for overriden functions...
Anders Carlsson [Sat, 27 Feb 2010 06:38:03 +0000 (06:38 +0000)]
Fix another vtable layout bug; we weren't looking hard enough for overriden functions when determining if an overrider will ever be used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97306 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoHandle vcall offset sharing between destructors.
Anders Carlsson [Sat, 27 Feb 2010 04:12:52 +0000 (04:12 +0000)]
Handle vcall offset sharing between destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97304 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a bug where we were generating an unnecessary vtable for a virtual base that...
Anders Carlsson [Sat, 27 Feb 2010 04:05:52 +0000 (04:05 +0000)]
Fix a bug where we were generating an unnecessary vtable for a virtual base that's already a primary virtual base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97303 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd test case for inlining call analysis.
Zhongxing Xu [Sat, 27 Feb 2010 02:44:37 +0000 (02:44 +0000)]
Add test case for inlining call analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97300 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRobustify SourceManager::getLocation(), so that it returns an
Douglas Gregor [Sat, 27 Feb 2010 02:42:25 +0000 (02:42 +0000)]
Robustify SourceManager::getLocation(), so that it returns an
end-of-line source location when given a column number beyond the
length of the line, or an end-of-file source location when given a
line number beyond the length of the file. Previously, we would return
an invalid location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97299 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd reference to positional arguments documentation.
Ted Kremenek [Sat, 27 Feb 2010 01:46:29 +0000 (01:46 +0000)]
Add reference to positional arguments documentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97298 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFor printf format string checking, add support for positional format strings.
Ted Kremenek [Sat, 27 Feb 2010 01:41:03 +0000 (01:41 +0000)]
For printf format string checking, add support for positional format strings.
Along the way, coelesce some of the diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97297 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen given unsaved files in clang_createTranslationUnitFromSourceFile,
Douglas Gregor [Sat, 27 Feb 2010 01:32:48 +0000 (01:32 +0000)]
When given unsaved files in clang_createTranslationUnitFromSourceFile,
copy the source buffers provided rather than referencing them
directly, so that the caller can free those buffers immediately after
calling clang_createTranslationUnitFromSourceFile(). Otherwise, we
risk hitting those buffers later (when building source ranges, forming
diagnostics, etc.).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97296 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSkip dependent virtual base classes; fixes PR6413.
Douglas Gregor [Sat, 27 Feb 2010 00:25:28 +0000 (00:25 +0000)]
Skip dependent virtual base classes; fixes PR6413.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97291 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPut BadLiteral in the NonGCC group. I'd completely forgotten about this.
John McCall [Fri, 26 Feb 2010 23:48:57 +0000 (23:48 +0000)]
Put BadLiteral in the NonGCC group.  I'd completely forgotten about this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97286 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAt sabre's request, drop the FP bounds diagnostics down to warnings and file
John McCall [Fri, 26 Feb 2010 23:35:57 +0000 (23:35 +0000)]
At sabre's request, drop the FP bounds diagnostics down to warnings and file
them under -Wbad-literal.  They're still on by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97284 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPrevent rewriter crash when variable type is missing.
Fariborz Jahanian [Fri, 26 Feb 2010 22:49:11 +0000 (22:49 +0000)]
Prevent rewriter crash when variable type is missing.
Fixes radar 7692183.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97281 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMinor cleanup of the rewriter.
Fariborz Jahanian [Fri, 26 Feb 2010 22:36:30 +0000 (22:36 +0000)]
Minor cleanup of the rewriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97280 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemoved some unused code in rewriter.
Fariborz Jahanian [Fri, 26 Feb 2010 21:46:27 +0000 (21:46 +0000)]
Removed some unused code in rewriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97274 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSundry fixes to the new vtable builder.
John McCall [Fri, 26 Feb 2010 20:22:44 +0000 (20:22 +0000)]
Sundry fixes to the new vtable builder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97258 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix rewriting of byref variables in nested blocks.
Fariborz Jahanian [Fri, 26 Feb 2010 19:55:31 +0000 (19:55 +0000)]
Fix rewriting of byref variables in nested blocks.
Fixes radar 7692350.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97254 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix rdar://7683173, rejecting an invalid conditional
Chris Lattner [Fri, 26 Feb 2010 19:42:53 +0000 (19:42 +0000)]
fix rdar://7683173, rejecting an invalid conditional

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97253 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFor printf format string checking, move the tracking of the data argument index out of
Ted Kremenek [Fri, 26 Feb 2010 19:18:41 +0000 (19:18 +0000)]
For printf format string checking, move the tracking of the data argument index out of
Sema and into analyze_printf::ParseFormatString().  Also use a bitvector to determine
what arguments have been covered (instead of just checking to see if the last argument consumed is the max argument).  This is prep. for support positional arguments (an IEEE extension).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97248 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRewriting of imported variable from outer
Fariborz Jahanian [Fri, 26 Feb 2010 19:05:20 +0000 (19:05 +0000)]
Rewriting of imported variable from outer
blocks's argument in the inner block requires special treatment.
Fixes radar 7692419.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97244 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse a GDM to record the returned expression in the state when VisitReturnStmt.
Zhongxing Xu [Fri, 26 Feb 2010 15:43:34 +0000 (15:43 +0000)]
Use a GDM to record the returned expression in the state when VisitReturnStmt.
Use this information to find the returned value and bind it to CallExpr in
ProcessCallExit.
And there is no need to remove dead bindings in ProcessCallExit, because
a. it would clean up the return value bound to CallExpr
b. we still would do it in the next ProcessStmt(), where we would not misclean
   up the return value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97225 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake the destructor public. ddunbar, lemme know if you'd prefer a different
Chandler Carruth [Fri, 26 Feb 2010 08:51:12 +0000 (08:51 +0000)]
Make the destructor public. ddunbar, lemme know if you'd prefer a different
fix, just trying to get the build bots happy again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97223 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake GDM private.
Zhongxing Xu [Fri, 26 Feb 2010 08:46:13 +0000 (08:46 +0000)]
Make GDM private.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97222 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix an assertion-on-error during tentative constructor parsing by
John McCall [Fri, 26 Feb 2010 08:45:28 +0000 (08:45 +0000)]
Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines.  Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code.  On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week.  Again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97221 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAn explicit specialization is allowed following an explicit
Douglas Gregor [Fri, 26 Feb 2010 06:03:23 +0000 (06:03 +0000)]
An explicit specialization is allowed following an explicit
instantiation so long as that explicit specialization was declared
previously. Fixes PR6160.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97210 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement semantic analysis for C++ [expr.new]p18-20, which describe
Douglas Gregor [Fri, 26 Feb 2010 05:06:18 +0000 (05:06 +0000)]
Implement semantic analysis for C++ [expr.new]p18-20, which describe
how we find the operator delete that matches withe operator new we
found in a C++ new-expression.

This will also need CodeGen support. On a happy note, we're now a
"nans" away from building tramp3d-v4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97209 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove derelict GRStmtNodeBuilder::LastNode.
Zhongxing Xu [Fri, 26 Feb 2010 02:38:09 +0000 (02:38 +0000)]
Remove derelict GRStmtNodeBuilder::LastNode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97207 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSupport rewriting of property synthesis with retain/copy
Fariborz Jahanian [Fri, 26 Feb 2010 01:42:20 +0000 (01:42 +0000)]
Support rewriting of property synthesis with retain/copy
attributes. Fixes radar 7214439.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97203 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCommit Eli's fix for implicit conversions to array type. Fixes PR6264.
Douglas Gregor [Fri, 26 Feb 2010 01:17:27 +0000 (01:17 +0000)]
Commit Eli's fix for implicit conversions to array type. Fixes PR6264.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97202 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't generate method metadata for @dynamic properties. Fixes PR6354.
David Chisnall [Fri, 26 Feb 2010 01:11:38 +0000 (01:11 +0000)]
Don't generate method metadata for @dynamic properties.  Fixes PR6354.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97199 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse the power of types to track down another canonicalization bug in
John McCall [Fri, 26 Feb 2010 00:48:12 +0000 (00:48 +0000)]
Use the power of types to track down another canonicalization bug in
the ABI-computation interface.  Fixes <rdar://problem/7691046>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97197 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake sure to mark constructors, operator new, and operator delete as
Douglas Gregor [Fri, 26 Feb 2010 00:38:10 +0000 (00:38 +0000)]
Make sure to mark constructors, operator new, and operator delete as
used when we instantiate C++ new expressions, delete expressions, and
object-construction expressions. Fixes PR6424, although we can't test
all of it until we finish implementing lookup of "operator delete" for
new expressions (!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97195 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate checker build.
Ted Kremenek [Fri, 26 Feb 2010 00:07:31 +0000 (00:07 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97186 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen we decide to re-use an existing CXXConstructExpr node, make sure
Douglas Gregor [Fri, 26 Feb 2010 00:01:57 +0000 (00:01 +0000)]
When we decide to re-use an existing CXXConstructExpr node, make sure
to mark the constructor as referenced. Fixes the narrow issue reported
in PR6424, but there are a few other places that I'll fix before
closing out that PR.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97185 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen computing the composite pointer type for relational comparisons,
Douglas Gregor [Thu, 25 Feb 2010 22:29:57 +0000 (22:29 +0000)]
When computing the composite pointer type for relational comparisons,
equality comparisons, and conditional operators, produce a composite
pointer type with the appropriate additional "const" qualifiers if the
pointer types would otherwise be incompatible. This is a small
extension (also present in GCC and EDG in a slightly different form)
that permits code like:

  void** i; void const** j;
  i == j;

with the following extwarn:

t.cpp:5:5: warning: comparison of distinct pointer types ('void **' and
      'void const **') uses non-standard composite pointer type
      'void const *const *' [-pedantic]
  i == j;
  ~ ^  ~

Fixes PR6346, and I'll be filing a core issue about this with the C++
committee.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97177 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove vcall offset handling.
Anders Carlsson [Thu, 25 Feb 2010 22:23:13 +0000 (22:23 +0000)]
Improve vcall offset handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97174 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFux a bug where we were trying to add overriders for non-virtual bases of virtual...
Anders Carlsson [Thu, 25 Feb 2010 22:18:35 +0000 (22:18 +0000)]
Fux a bug where we were trying to add overriders for non-virtual bases of virtual bases more than once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97173 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove ~CodeGenAction out-of-line.
Daniel Dunbar [Thu, 25 Feb 2010 20:37:44 +0000 (20:37 +0000)]
Move ~CodeGenAction out-of-line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97166 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRestore Zhongxing's commits r97122 r97127 r97129 r97131 which were reverted due to...
Douglas Gregor [Thu, 25 Feb 2010 19:01:53 +0000 (19:01 +0000)]
Restore Zhongxing's commits r97122 r97127 r97129 r97131 which were reverted due to a Clang-on-Clang failure

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97162 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllow us to compare derived-to-base conversions between a reference
Douglas Gregor [Thu, 25 Feb 2010 19:01:05 +0000 (19:01 +0000)]
Allow us to compare derived-to-base conversions between a reference
binding and a copy-construction. Fixes an overloading problem in the
Clang-on-Clang build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97161 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoForgot to include nested protocols in collection, resulting in
Fariborz Jahanian [Thu, 25 Feb 2010 18:24:33 +0000 (18:24 +0000)]
Forgot to include nested protocols in collection, resulting in
bogus warning. Fixes radar 7682116.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97157 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't try to finalize an ill-formed variable or one whose class type is ill-formed...
Douglas Gregor [Thu, 25 Feb 2010 18:11:54 +0000 (18:11 +0000)]
Don't try to finalize an ill-formed variable or one whose class type is ill-formed. Fixes PR6421

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97152 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert patches r97122 r97127 r97129 r97131.
Jakob Stoklund Olesen [Thu, 25 Feb 2010 15:47:53 +0000 (15:47 +0000)]
Revert patches r97122 r97127 r97129 r97131.
They were breaking clang-x86_64-darwin10-selfhost

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97138 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd "template" keyword at strategic position to fix
Gabor Greif [Thu, 25 Feb 2010 13:04:33 +0000 (13:04 +0000)]
Add "template" keyword at strategic position to fix
compilation using g++ v3.4.

I'll watch the buildbots and back out if necessary.
Feel free to do the same if something breaks.

Without this patch I get (on g++ 3.4.6) following error:

In file included from clang/lib/Sema/SemaTemplate.cpp:14:
clang/lib/Sema/TreeTransform.h: In member function `clang::ASTOwningResult<&clang::ActionBase::DeleteExpr> clang::TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(clang::ASTOwningResult<&clang::ActionBase::DeleteExpr>, clang::SourceLocation, bool, clang::NestedNameSpecifier*, clang::SourceRange, clang::TypeSourceInfo*, clang::SourceLocation, clang::SourceLocation, clang::PseudoDestructorTypeStorage)':
clang/lib/Sema/TreeTransform.h:5784: error: expected primary-expression before '>' token
clang/lib/Sema/TreeTransform.h:5784: error: expected primary-expression before ')' token
make[4]: *** [clang/lib/Sema/Release/SemaTemplate.o] Error 1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97136 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen comparing two method overload candidates during overload diagnostics,
John McCall [Thu, 25 Feb 2010 10:46:05 +0000 (10:46 +0000)]
When comparing two method overload candidates during overload diagnostics,
skip the object argument conversion if either of the candidates didn't
initialize it.

Fixes PR6421, which is such a very straightforward extension of PR6398 that I
should have worked it into the last test case (and therefore caught it then).
Ah well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97135 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a really trivial crasher and begin fleshing out one of the namespace test
Chandler Carruth [Thu, 25 Feb 2010 09:32:59 +0000 (09:32 +0000)]
Fix a really trivial crasher and begin fleshing out one of the namespace test
cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97134 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a minimal C interpreter example.
Daniel Dunbar [Thu, 25 Feb 2010 08:49:05 +0000 (08:49 +0000)]
Add a minimal C interpreter example.
 - Demonstrates how to build a standalone tool which loads source code using the
   Driver and Frontend libraries, and then uses CodeGen and the JIT to actually
   execute the code.

 - Still more complicated than it should be, but hey its only 153 lines. :)

--
ddunbar@ozzy:tmp$ cat hello.c
#include <stdio.h>
int main() { printf("hello world\n"); return 0; }
ddunbar@ozzy:tmp$ clang-interpreter hello.c
hello world
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97133 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove the GenerateCallExitNode logic completely into GREndPathNodeBuilder.
Zhongxing Xu [Thu, 25 Feb 2010 07:57:35 +0000 (07:57 +0000)]
Move the GenerateCallExitNode logic completely into GREndPathNodeBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97131 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove the dead bindings removal logic from CallInliner to GRExprEngine::ProcessCallExit().
Zhongxing Xu [Thu, 25 Feb 2010 07:36:34 +0000 (07:36 +0000)]
Move the dead bindings removal logic from CallInliner to GRExprEngine::ProcessCallExit().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97129 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a new conversion rank to classify conversions between complex and scalar
Chandler Carruth [Thu, 25 Feb 2010 07:20:54 +0000 (07:20 +0000)]
Add a new conversion rank to classify conversions between complex and scalar
types. Rank these conversions below other conversions. This allows overload
resolution when the only distinction is between a complex and scalar type. It
also brings the complex overload resolutin in line with GCC's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97128 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd comments.
Zhongxing Xu [Thu, 25 Feb 2010 07:03:08 +0000 (07:03 +0000)]
Add comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97127 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCall inliner improvements:
Zhongxing Xu [Thu, 25 Feb 2010 06:46:30 +0000 (06:46 +0000)]
Call inliner improvements:

This patch implements the CallEnter/CallExit idea of Ted.

Add two interfaces to GRSubEngine: ProcessCallEnter, ProcessCallExit.

The CallEnter program point uses caller's location context. The
CallExit program point uses callee's location context.

CallEnter is built by GRStmtNodeBuilder. CallExit is built by
GREndPathNodeBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97122 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd MacOSXAPIChecker, a meta checker to include various precondition checks for calls
Ted Kremenek [Thu, 25 Feb 2010 05:44:09 +0000 (05:44 +0000)]
Add MacOSXAPIChecker, a meta checker to include various precondition checks for calls
to various MacOS X functions.  The checks in BasicObjCFoundationChecks.cpp will
gradually be migrated here.

As a first check, check that when 'dispatch_once()' is passed a predicate value
that has non-local storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97116 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen generating error node, check to see if we already cached out.
Ted Kremenek [Thu, 25 Feb 2010 05:44:05 +0000 (05:44 +0000)]
When generating error node, check to see if we already cached out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97115 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTargets (like pic16) may have mangled the name of global variables,
Sanjiv Gupta [Thu, 25 Feb 2010 05:20:44 +0000 (05:20 +0000)]
Targets (like pic16) may have mangled the name of global variables,
so get the name from Var rather than the original decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97114 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate CMake makefiles
Douglas Gregor [Thu, 25 Feb 2010 04:52:01 +0000 (04:52 +0000)]
Update CMake makefiles

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97113 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRestore the invariant that a nested-name-specifier can only contain
Douglas Gregor [Thu, 25 Feb 2010 04:46:04 +0000 (04:46 +0000)]
Restore the invariant that a nested-name-specifier can only contain
class types, dependent types, and namespaces. I had previously
weakened this invariant while working on parsing pseudo-destructor
expressions, but recent work in that area has made these changes
unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97112 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFrontend: Add CodeGenAction::takeModule().
Daniel Dunbar [Thu, 25 Feb 2010 04:37:50 +0000 (04:37 +0000)]
Frontend: Add CodeGenAction::takeModule().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97111 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFrontend: Pull CodeGenAction out more, and eliminate CreateBackendConsumer.
Daniel Dunbar [Thu, 25 Feb 2010 04:37:45 +0000 (04:37 +0000)]
Frontend: Pull CodeGenAction out more, and eliminate CreateBackendConsumer.

This is the way I would like to move the frontend function towards -- distinct
pieces of functionality should be exposed only via FrontendAction
implementations which have clean and relatively-stable APIs.

This also isolates the surface area in clang which depends on LLVM CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97110 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove dead code.
Anders Carlsson [Thu, 25 Feb 2010 03:57:50 +0000 (03:57 +0000)]
Remove dead code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97109 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove the vcall and vbase offset layout code out into its own class.
Anders Carlsson [Thu, 25 Feb 2010 03:45:56 +0000 (03:45 +0000)]
Move the vcall and vbase offset layout code out into its own class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97107 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Allow driver title (for --help) to be overridden by clients.
Daniel Dunbar [Thu, 25 Feb 2010 03:31:53 +0000 (03:31 +0000)]
Driver: Allow driver title (for --help) to be overridden by clients.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97106 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEnhance the unused ivar checker to not consider an ivar to be accidentally unused
Ted Kremenek [Thu, 25 Feb 2010 03:26:55 +0000 (03:26 +0000)]
Enhance the unused ivar checker to not consider an ivar to be accidentally unused
when it is explicitly marked as unused via __attribute__((unused)).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97104 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllow __attribute__((unused)) to be applied to ObjC ivars.
Ted Kremenek [Thu, 25 Feb 2010 03:26:51 +0000 (03:26 +0000)]
Allow __attribute__((unused)) to be applied to ObjC ivars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97103 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Use TextDiagnosticPrinter instead of a custom one.
Daniel Dunbar [Thu, 25 Feb 2010 03:23:43 +0000 (03:23 +0000)]
Driver: Use TextDiagnosticPrinter instead of a custom one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97102 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd TextDiagnosticPrinter::setPrefix, for adding a string to prefix diagnostic
Daniel Dunbar [Thu, 25 Feb 2010 03:23:40 +0000 (03:23 +0000)]
Add TextDiagnosticPrinter::setPrefix, for adding a string to prefix diagnostic
messages with.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97101 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove some oogly code made dead by the pseudo-destructor
Douglas Gregor [Thu, 25 Feb 2010 02:00:27 +0000 (02:00 +0000)]
Remove some oogly code made dead by the pseudo-destructor
instantiation changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97095 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse CXXPseudoDestructorExpr as the stored representation for dependent
Douglas Gregor [Thu, 25 Feb 2010 01:56:36 +0000 (01:56 +0000)]
Use CXXPseudoDestructorExpr as the stored representation for dependent
expressions that look like pseudo-destructors, e.g.,

  p->T::~T()

where p has dependent type.

At template instantiate time, we determine whether we actually have a
pseudo-destructor or a member access, and funnel down to the
appropriate routine in Sema.

Fixes PR6380.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97092 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCatch more uses of uninitialized implicit conversion sequences.
John McCall [Thu, 25 Feb 2010 01:37:24 +0000 (01:37 +0000)]
Catch more uses of uninitialized implicit conversion sequences.
When diagnosing bad conversions, skip the conversion for ignored object
arguments.  Fixes PR 6398.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97090 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove test case dependancy on platform headers.
Ted Kremenek [Thu, 25 Feb 2010 01:16:07 +0000 (01:16 +0000)]
Remove test case dependancy on platform headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97088 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd UnixAPIChecker, a meta checker to include various precondition checks for calls
Ted Kremenek [Thu, 25 Feb 2010 00:20:35 +0000 (00:20 +0000)]
Add UnixAPIChecker, a meta checker to include various precondition checks for calls
to various unix/posix functions, e.g. 'open()'.

As a first check, check that when 'open()' is passed 'O_CREAT' that it has
a third argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97086 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove stray #include.
Ted Kremenek [Thu, 25 Feb 2010 00:20:31 +0000 (00:20 +0000)]
Remove stray #include.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97085 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove #include.
Ted Kremenek [Thu, 25 Feb 2010 00:20:28 +0000 (00:20 +0000)]
Remove #include.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97084 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDivide list of registration functions in API and foundational checks. Also trim...
Ted Kremenek [Thu, 25 Feb 2010 00:20:25 +0000 (00:20 +0000)]
Divide list of registration functions in API and foundational checks.  Also trim whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97083 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSort list of checker registration functions.
Ted Kremenek [Thu, 25 Feb 2010 00:20:22 +0000 (00:20 +0000)]
Sort list of checker registration functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97082 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoKeep track of the location of the '~' in a pseudo-destructor expression.
Douglas Gregor [Wed, 24 Feb 2010 23:50:37 +0000 (23:50 +0000)]
Keep track of the location of the '~' in a pseudo-destructor expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97080 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRetain complete source information for the type after the '~' in a
Douglas Gregor [Wed, 24 Feb 2010 23:40:28 +0000 (23:40 +0000)]
Retain complete source information for the type after the '~' in a
CXXPseudoDestructorExpr.

Update template instantiation for pseudo-destructor expressions to use
this source information and to make use of
Sema::BuildPseudoDestructorExpr when the base expression is dependent
or refers to a scalar type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97079 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake sure that we finish the DeclSpec when parsing a C++
Douglas Gregor [Wed, 24 Feb 2010 23:13:13 +0000 (23:13 +0000)]
Make sure that we finish the DeclSpec when parsing a C++
type-specifier-seq. Fixes some conditional-jump-on-unitialized-value
errors in valgrind. Also counts as attempt #2 at making the MSVC
buildbot happy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97077 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake sure that we have type source information for the scope type of a
Douglas Gregor [Wed, 24 Feb 2010 23:02:30 +0000 (23:02 +0000)]
Make sure that we have type source information for the scope type of a
pseudo-destructor expression. Attempt #1 at fixing the MSVC buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97076 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdded test case for non-objective-c situation in
Fariborz Jahanian [Wed, 24 Feb 2010 22:53:58 +0000 (22:53 +0000)]
Added test case for non-objective-c situation in
my last patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97075 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement nasty rewriting of nested blocks when inner
Fariborz Jahanian [Wed, 24 Feb 2010 22:48:18 +0000 (22:48 +0000)]
Implement nasty rewriting of nested blocks when inner
blocks use variables not used in any of the outer blocks.
(Fixes radar 7682149).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97073 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSplit ActOnPseudoDestructorExpr into the part that interprets the
Douglas Gregor [Wed, 24 Feb 2010 22:38:50 +0000 (22:38 +0000)]
Split ActOnPseudoDestructorExpr into the part that interprets the
parser's data structures and the part that performs semantic analysis
and AST building, in preparation for improved template instantiation
of pseudo-destructor expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97070 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGet rid of 'this' adjustments from the FinalOverriders class since they can be differ...
Anders Carlsson [Wed, 24 Feb 2010 22:32:18 +0000 (22:32 +0000)]
Get rid of 'this' adjustments from the FinalOverriders class since they can be different for the same overrider in different parts of the vtable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97068 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove this adjustment pointer calculation.
Anders Carlsson [Wed, 24 Feb 2010 22:27:12 +0000 (22:27 +0000)]
Improve this adjustment pointer calculation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97067 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake ComputeThisAdjustmentBaseOffset public for now.
Anders Carlsson [Wed, 24 Feb 2010 22:18:01 +0000 (22:18 +0000)]
Make ComputeThisAdjustmentBaseOffset public for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97066 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd test case for PR6141, which was fixed a few days ago
Douglas Gregor [Wed, 24 Feb 2010 21:54:27 +0000 (21:54 +0000)]
Add test case for PR6141, which was fixed a few days ago

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97063 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd test for AST importing of C++ namespaces, missing from a prior commit
Douglas Gregor [Wed, 24 Feb 2010 21:53:36 +0000 (21:53 +0000)]
Add test for AST importing of C++ namespaces, missing from a prior commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97062 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd PCH test for C++ namespaces, missing from a previous commit
Douglas Gregor [Wed, 24 Feb 2010 21:52:55 +0000 (21:52 +0000)]
Add PCH test for C++ namespaces, missing from a previous commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97061 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRetain source information for the "type-name ::" in a
Douglas Gregor [Wed, 24 Feb 2010 21:52:20 +0000 (21:52 +0000)]
Retain source information for the "type-name ::" in a
pseudo-destructor expression such as

  p->T::~T()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97060 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoActOnPseudoDestructorExpr now performs all semantic analysis for
Douglas Gregor [Wed, 24 Feb 2010 21:29:12 +0000 (21:29 +0000)]
ActOnPseudoDestructorExpr now performs all semantic analysis for
pseudo-destructor expressions, and builds the CXXPseudoDestructorExpr
node directly. Currently, this only affects pseudo-destructor
expressions when they are parsed, but not after template
instantiation. That's coming next...

Improve parsing of pseudo-destructor-names. When parsing the
nested-name-specifier and we hit the sequence of tokens X :: ~, query
the actual module to determine whether X is a type-name (in which case
the X :: is part of the pseudo-destructor-name but not the
nested-name-specifier) or not (in which case the X :: is part of the
nested-name-specifier).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97058 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix an iterator-invalidation bug that was causing selfhost errors
John McCall [Wed, 24 Feb 2010 20:32:01 +0000 (20:32 +0000)]
Fix an iterator-invalidation bug that was causing selfhost errors
on non-darwin platforms.  Fixes PR6411. Test case doesn't reduce,
unfortunately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97055 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRework parsing of pseudo-destructor expressions and explicit
Douglas Gregor [Wed, 24 Feb 2010 18:44:31 +0000 (18:44 +0000)]
Rework parsing of pseudo-destructor expressions and explicit
destructor calls, e.g.,

  p->T::~T

We now detect when the member access that we've parsed, e.g.,

  p-> or x.

may be a pseudo-destructor expression, either because the type of p or
x is a scalar or because it is dependent (and, therefore, may become a
scalar at template instantiation time).

We then parse the pseudo-destructor grammar specifically:

  ::[opt] nested-name-specifier[opt] type-name :: ∼ type-name

and hand those results to a new action, ActOnPseudoDestructorExpr,
which will cope with both dependent member accesses of destructors and
with pseudo-destructor expressions.

This commit affects the parsing of pseudo-destructors, only; the
semantic actions still go through the semantic actions for member
access expressions. That will change soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97045 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGenerate correct vcall offsets when we have a primary virtual base that is not a...
Anders Carlsson [Wed, 24 Feb 2010 16:43:12 +0000 (16:43 +0000)]
Generate correct vcall offsets when we have a primary virtual base that is not a primary base in the complete class hierarchy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97039 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReferences to const int parameters with ICE default arguments are not ICEs.
John McCall [Wed, 24 Feb 2010 09:03:18 +0000 (09:03 +0000)]
References to const int parameters with ICE default arguments are not ICEs.
Fixes PR6373.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97037 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake this test portable to ABIs that use sret.
John McCall [Wed, 24 Feb 2010 08:14:27 +0000 (08:14 +0000)]
Make this test portable to ABIs that use sret.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97035 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix test case and convert fully to FileCheck.
John McCall [Wed, 24 Feb 2010 07:33:39 +0000 (07:33 +0000)]
Fix test case and convert fully to FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97032 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCanonicalize parameter and return types before computing ABI info. Eliminates
John McCall [Wed, 24 Feb 2010 07:14:12 +0000 (07:14 +0000)]
Canonicalize parameter and return types before computing ABI info.  Eliminates
a common source of oddities and, in theory, removes some redundant ABI
computations.  Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization;  this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97030 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd comments.
Zhongxing Xu [Wed, 24 Feb 2010 04:54:56 +0000 (04:54 +0000)]
Add comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97020 91177308-0d34-0410-b5e6-96231b3b80d8