]> granicus.if.org Git - clang/log
clang
14 years agoPCH read/write for selector reference pool.
Fariborz Jahanian [Fri, 23 Jul 2010 19:11:11 +0000 (19:11 +0000)]
PCH read/write for selector reference pool.
Finishes off radar 6507158.

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

14 years agoDataflow solver: Don't overrwite the initial value of a block with top unless new...
Ted Kremenek [Fri, 23 Jul 2010 18:15:17 +0000 (18:15 +0000)]
Dataflow solver: Don't overrwite the initial value of a block with top unless new values are available.  Patch by Simone Pellegrini!

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

14 years agoVectors are not integer types, so the type system should not classify
Douglas Gregor [Fri, 23 Jul 2010 15:58:24 +0000 (15:58 +0000)]
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!

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

14 years agoAdd FILE* leak check to StreamChecker. Patch by Lei Zhang.
Zhongxing Xu [Fri, 23 Jul 2010 14:14:59 +0000 (14:14 +0000)]
Add FILE* leak check to StreamChecker. Patch by Lei Zhang.

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

14 years agoRemove unneeded iostream include.
Bill Wendling [Fri, 23 Jul 2010 07:19:31 +0000 (07:19 +0000)]
Remove unneeded iostream include.

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

14 years agoChange arg type.
Zhongxing Xu [Fri, 23 Jul 2010 05:55:01 +0000 (05:55 +0000)]
Change arg type.

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

14 years agoDelete unnecessary const_cast.
Zhongxing Xu [Fri, 23 Jul 2010 02:54:53 +0000 (02:54 +0000)]
Delete unnecessary const_cast.

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

14 years agoAnalysisContext is not const.
Zhongxing Xu [Fri, 23 Jul 2010 02:49:07 +0000 (02:49 +0000)]
AnalysisContext is not const.

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

14 years agoFix build on Ubuntu 10.04.
Zhongxing Xu [Fri, 23 Jul 2010 02:15:08 +0000 (02:15 +0000)]
Fix build on Ubuntu 10.04.

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

14 years agoBasic plumbing for generating a precompiled preamble for an
Douglas Gregor [Fri, 23 Jul 2010 00:33:23 +0000 (00:33 +0000)]
Basic plumbing for generating a precompiled preamble for an
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.

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

14 years agoWarn when property ivar lookup finds a global variable
Fariborz Jahanian [Thu, 22 Jul 2010 23:33:21 +0000 (23:33 +0000)]
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.

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

14 years agoTed pointed out that this test case could be using access control instead of
John McCall [Thu, 22 Jul 2010 22:44:38 +0000 (22:44 +0000)]
Ted pointed out that this test case could be using access control instead of
__attribute__((unavailable)).  I've done so, but unfortunately there's still a case
of redundant diagnostics.

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

14 years agoThread bitstream cursors all the way through the AST reading stuff. This way, reading...
Sebastian Redl [Thu, 22 Jul 2010 22:43:28 +0000 (22:43 +0000)]
Thread bitstream cursors all the way through the AST reading stuff. This way, reading a trivial 2-element chained file actually works.

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

14 years agoKeep track of artificial scopes introduced by line directives. For example,
Devang Patel [Thu, 22 Jul 2010 22:29:16 +0000 (22:29 +0000)]
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.

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

14 years agoTurn off EH cleanups for __block variables; they caused some internal buildbot
John McCall [Thu, 22 Jul 2010 21:25:44 +0000 (21:25 +0000)]
Turn off EH cleanups for __block variables;  they caused some internal buildbot
failures.  There's a radar tracking this.

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

14 years agoImprove performance during cursor traversal when a region of interest
Douglas Gregor [Thu, 22 Jul 2010 20:22:31 +0000 (20:22 +0000)]
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>.

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

14 years agoatch for implementation of objective-c's -Wselector
Fariborz Jahanian [Thu, 22 Jul 2010 18:24:20 +0000 (18:24 +0000)]
atch for implementation of objective-c's -Wselector
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.

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

14 years agoDon't crash when an explicit template instantiation has no user-written
Nick Lewycky [Thu, 22 Jul 2010 17:56:53 +0000 (17:56 +0000)]
Don't crash when an explicit template instantiation has no user-written
arguments. This happens in clang itself where template:

  template <typename T> T const *getAs();

gets specialized with:

  template<> inline clang::TypedefType const *getAs() { ... }

and there's no TemplateArgumentList.

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

14 years agoSerialization is implemented, fix comments.
Argyrios Kyrtzidis [Thu, 22 Jul 2010 17:28:27 +0000 (17:28 +0000)]
Serialization is implemented, fix comments.

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

14 years agoRead/write C++0x static_assert for PCH.
Argyrios Kyrtzidis [Thu, 22 Jul 2010 17:28:12 +0000 (17:28 +0000)]
Read/write C++0x static_assert for PCH.

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

14 years agoAllow loading declcontext information from any file in the chain. Properly write...
Sebastian Redl [Thu, 22 Jul 2010 17:01:13 +0000 (17:01 +0000)]
Allow loading declcontext information from any file in the chain. Properly write source locations to dependent files. WIP

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

14 years agoRead/write FriendTemplateDecl for PCH.
Argyrios Kyrtzidis [Thu, 22 Jul 2010 16:04:10 +0000 (16:04 +0000)]
Read/write FriendTemplateDecl for PCH.

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

14 years agoSupport C++ try/catch statements for PCH.
Argyrios Kyrtzidis [Thu, 22 Jul 2010 16:03:56 +0000 (16:03 +0000)]
Support C++ try/catch statements for PCH.

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

14 years agoThis patch adds support for tmpfile in StreamChecker. Patch by Lei Zhang.
Zhongxing Xu [Thu, 22 Jul 2010 14:01:01 +0000 (14:01 +0000)]
This patch adds support for tmpfile in StreamChecker. Patch by Lei Zhang.

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

14 years agoMake a bunch of new data structures for the new analysis
Zhongxing Xu [Thu, 22 Jul 2010 13:52:13 +0000 (13:52 +0000)]
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.

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

14 years agoFix '<rdar://problem/8214263> MakeCXCursor null dereference when body of block is...
Ted Kremenek [Thu, 22 Jul 2010 11:30:19 +0000 (11:30 +0000)]
Fix '<rdar://problem/8214263> MakeCXCursor null dereference when body of block is invalid' by checking that the body of a BlockDecl is null before constructing a CXCursor.

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

14 years agoUpdate test case to include USRs containing offsets instead of line/columns.
Ted Kremenek [Thu, 22 Jul 2010 11:30:17 +0000 (11:30 +0000)]
Update test case to include USRs containing offsets instead of line/columns.

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

14 years agoSwitch USR generation to use file offsets instead of line/columns for anonymous symbo...
Ted Kremenek [Thu, 22 Jul 2010 11:14:15 +0000 (11:14 +0000)]
Switch USR generation to use file offsets instead of line/columns for anonymous symbols.  Fixes <rdar://problem/8221557>.

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

14 years agoFix PR7673 by allowing an empty clobbers section in an ASM statement.
Chandler Carruth [Thu, 22 Jul 2010 07:11:21 +0000 (07:11 +0000)]
Fix PR7673 by allowing an empty clobbers section in an ASM statement.

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

14 years agoAdd alternate names for x86 SIMD intrinsics. These aren't as common, but show
Chandler Carruth [Thu, 22 Jul 2010 06:47:28 +0000 (06:47 +0000)]
Add alternate names for x86 SIMD intrinsics. These aren't as common, but show
up enough to be worth supporting properly. Fixes PR7674.

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

14 years agoThis was still complaining about the length of the string. I've broken it here
Chandler Carruth [Thu, 22 Jul 2010 06:29:13 +0000 (06:29 +0000)]
This was still complaining about the length of the string. I've broken it here
to try to keep as much logical grouping as possible.

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

14 years agotests: Make FileCheck version check that preamble isn't longer than we expected.
Daniel Dunbar [Thu, 22 Jul 2010 02:22:24 +0000 (02:22 +0000)]
tests: Make FileCheck version check that preamble isn't longer than we expected.

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

14 years agoDriver/Darwin: Set -force_cpusubtype_ALL only by default on x86.
Daniel Dunbar [Thu, 22 Jul 2010 01:47:22 +0000 (01:47 +0000)]
Driver/Darwin: Set -force_cpusubtype_ALL only by default on x86.

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

14 years agobuild: Make sure arm_neon.h gets installed.
Daniel Dunbar [Thu, 22 Jul 2010 01:19:36 +0000 (01:19 +0000)]
build: Make sure arm_neon.h gets installed.

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

14 years agoDriver/Darwin: Always allow blocks on Darwin, so that users can conditionally
Daniel Dunbar [Thu, 22 Jul 2010 00:40:31 +0000 (00:40 +0000)]
Driver/Darwin: Always allow blocks on Darwin, so that users can conditionally
use blocks even when targetting older systems (using runtime checks and weak
linking).

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

14 years agoObjCId is special "struct objc_object". Make this explicit in debug info.
Devang Patel [Wed, 21 Jul 2010 22:41:25 +0000 (22:41 +0000)]
ObjCId is special "struct objc_object". Make this explicit in debug info.
This is tested by objc-rbreak.exp in gdb testsuite.

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

14 years agoAllow loading macros from any file in the chain. WIP
Sebastian Redl [Wed, 21 Jul 2010 22:31:37 +0000 (22:31 +0000)]
Allow loading macros from any file in the chain. WIP

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

14 years agotests: XFAIL this test on win32, someone else can hunt this one down.
Daniel Dunbar [Wed, 21 Jul 2010 22:09:09 +0000 (22:09 +0000)]
tests: XFAIL this test on win32, someone else can hunt this one down.

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

14 years agoUpgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior...
Ted Kremenek [Wed, 21 Jul 2010 20:43:11 +0000 (20:43 +0000)]
Upgrade "'X' is unavailable" from a warning to an error.  This matches GCC's behavior.  Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent.  We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.

Fixes <rdar://problem/8213093>.

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

14 years agoPromote some macro-related stuff to per-file data. Fix a cache-inefficient nested...
Sebastian Redl [Wed, 21 Jul 2010 20:07:32 +0000 (20:07 +0000)]
Promote some macro-related stuff to per-file data. Fix a cache-inefficient nested loop by inverting the nesting. Store the size of each file in the chain; will need this later for statement offsets.

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

14 years agotests: Use FileCheck instead of external input; I think this test was failing on
Daniel Dunbar [Wed, 21 Jul 2010 19:40:01 +0000 (19:40 +0000)]
tests: Use FileCheck instead of external input; I think this test was failing on
Win32 because of line ending differences.

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

14 years agoIntroduce a new C API function, clang_parseTranslationUnit(), which
Douglas Gregor [Wed, 21 Jul 2010 18:52:53 +0000 (18:52 +0000)]
Introduce a new C API function, clang_parseTranslationUnit(), which
will eventually replace
clang_createTranslationUnitFromSourceFile(). The only addition in
clang_parseTranslationUnit() is a set of flags that can control how
the translation unit is loaded. More interesting flags will be coming.

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

14 years agoAdded extra check when looking for location of '=' in
Fariborz Jahanian [Wed, 21 Jul 2010 18:40:47 +0000 (18:40 +0000)]
Added extra check when looking for location of '=' in
a copy initialization.

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

14 years agoFix source location of the initializer in
Fariborz Jahanian [Wed, 21 Jul 2010 18:31:47 +0000 (18:31 +0000)]
Fix source location of the initializer in
a copy initialization. Back out hack in objc rewriter.
fixes radar 8213998.

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

14 years agoCatch thinko that Daniel Dunbar found.
Nate Begeman [Wed, 21 Jul 2010 18:11:42 +0000 (18:11 +0000)]
Catch thinko that Daniel Dunbar found.

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

14 years agoFix regression caused by r108911.
Devang Patel [Wed, 21 Jul 2010 18:08:50 +0000 (18:08 +0000)]
Fix regression caused by r108911.
Do not override known debug loc with unknown debug loc.
This is tested by sections.exp in gdb testsuite.

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

14 years agoFix a rewriter bug which originates in SemaInit involving
Fariborz Jahanian [Wed, 21 Jul 2010 17:36:39 +0000 (17:36 +0000)]
Fix a rewriter bug which originates in SemaInit involving
Constructor Initialization which computes Source Location
differently now. Fixes radar 8213998.

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

14 years agoDon't crash when sending a message inside a block with the non-fragile ABI (GNU runtime).
David Chisnall [Wed, 21 Jul 2010 15:28:28 +0000 (15:28 +0000)]
Don't crash when sending a message inside a block with the non-fragile ABI (GNU runtime).

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

14 years agoMark the load after calling objc_msg_lookup_sender() so that it doesn't get optimised...
David Chisnall [Wed, 21 Jul 2010 12:55:25 +0000 (12:55 +0000)]
Mark the load after calling objc_msg_lookup_sender() so that it doesn't get optimised away (GNU runtime).

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

14 years agoRename LazyCleanup -> Cleanup. No functionality change for these last three
John McCall [Wed, 21 Jul 2010 07:22:38 +0000 (07:22 +0000)]
Rename LazyCleanup -> Cleanup.  No functionality change for these last three
commits.

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

14 years agoRip out EHCleanupScope.
John McCall [Wed, 21 Jul 2010 07:11:21 +0000 (07:11 +0000)]
Rip out EHCleanupScope.

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

14 years agoKill the CleanupBlock API.
John McCall [Wed, 21 Jul 2010 07:04:01 +0000 (07:04 +0000)]
Kill the CleanupBlock API.

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

14 years agoSwitch the fragile-ABI @finally/@synchronized cleanup over to using a lazy
John McCall [Wed, 21 Jul 2010 06:59:36 +0000 (06:59 +0000)]
Switch the fragile-ABI @finally/@synchronized cleanup over to using a lazy
cleanup.

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

14 years agoCode simplification.
John McCall [Wed, 21 Jul 2010 06:45:54 +0000 (06:45 +0000)]
Code simplification.

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

14 years agoSwitch the main possibly-conditional temporary cleanup over to being lazy.
John McCall [Wed, 21 Jul 2010 06:44:28 +0000 (06:44 +0000)]
Switch the main possibly-conditional temporary cleanup over to being lazy.

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

14 years agoSwitch the destructor for a temporary arising from a reference binding over to
John McCall [Wed, 21 Jul 2010 06:29:51 +0000 (06:29 +0000)]
Switch the destructor for a temporary arising from a reference binding over to
using a lazy cleanup.

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

14 years agoSwitch the __cxa_guard_abort cleanup to being a lazy cleanup.
John McCall [Wed, 21 Jul 2010 06:20:50 +0000 (06:20 +0000)]
Switch the __cxa_guard_abort cleanup to being a lazy cleanup.

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

14 years agoSwitch some random local-decl cleanups over to using lazy cleanups. Turn on
John McCall [Wed, 21 Jul 2010 06:13:08 +0000 (06:13 +0000)]
Switch some random local-decl cleanups over to using lazy cleanups.  Turn on
the block-release unwind cleanup:  we're never going to test it if we don't turn
it on.

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

14 years agoSwitch finally cleanups over to being lazy cleanups. We get basically nothing
John McCall [Wed, 21 Jul 2010 05:47:49 +0000 (05:47 +0000)]
Switch finally cleanups over to being lazy cleanups.  We get basically nothing
from the laziness features here except better block ordering, but it removes yet
another CleanupBlock use.

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

14 years agoImplement proper base/member destructor EH chaining.
John McCall [Wed, 21 Jul 2010 05:30:47 +0000 (05:30 +0000)]
Implement proper base/member destructor EH chaining.

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

14 years agoMove some methods inline.
Zhongxing Xu [Wed, 21 Jul 2010 05:21:41 +0000 (05:21 +0000)]
Move some methods inline.

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

14 years agoFix win64 compilation of constants like 0xFFFFFFFFFFFFFFFFULL
Nate Begeman [Wed, 21 Jul 2010 02:02:56 +0000 (02:02 +0000)]
Fix win64 compilation of constants like 0xFFFFFFFFFFFFFFFFULL

intmax_t is __int64 (long long to clang), per VS 2010 stdint.h

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

14 years agoChange PushDestructorCleanup to use lazy cleanups.
John McCall [Wed, 21 Jul 2010 01:41:18 +0000 (01:41 +0000)]
Change PushDestructorCleanup to use lazy cleanups.

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

14 years agoConvert the EH cleanups for base and member destructors in a constructor into
John McCall [Wed, 21 Jul 2010 01:23:41 +0000 (01:23 +0000)]
Convert the EH cleanups for base and member destructors in a constructor into
lazy cleanups.

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

14 years agoImplement zero-initialization for array new when there is an
Douglas Gregor [Wed, 21 Jul 2010 01:10:17 +0000 (01:10 +0000)]
Implement zero-initialization for array new when there is an
initializer of (). Make sure to use a simple memset() when we can, or
fall back to generating a loop when a simple memset will not
suffice. Fixes <rdar://problem/8212208>, a regression due to my work
in r107857.

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

14 years agoConvert the end-catch call for finally blocks to a lazy cleanup. This kills off
John McCall [Wed, 21 Jul 2010 00:52:03 +0000 (00:52 +0000)]
Convert the end-catch call for finally blocks to a lazy cleanup.  This kills off
the last of the shared-code cleanups.

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

14 years agoAllow loading identifiers from any file in the chain. WIP
Sebastian Redl [Wed, 21 Jul 2010 00:46:22 +0000 (00:46 +0000)]
Allow loading identifiers from any file in the chain. WIP

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

14 years agoConvert the ObjC @synchronized cleanups to laziness. This is not actually
John McCall [Wed, 21 Jul 2010 00:41:47 +0000 (00:41 +0000)]
Convert the ObjC @synchronized cleanups to laziness.  This is not actually
a big deal, except that I want to eliminate the shared-code EH cleanups
in preparation for a significant algorithmic fix.

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

14 years agoAdd a little helper method which will be useful soon.
John McCall [Wed, 21 Jul 2010 00:40:03 +0000 (00:40 +0000)]
Add a little helper method which will be useful soon.

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

14 years agoApparently not every system thinks that references in pairs are as cool as I think.
Sebastian Redl [Tue, 20 Jul 2010 22:55:31 +0000 (22:55 +0000)]
Apparently not every system thinks that references in pairs are as cool as I think.

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

14 years agoAllow loading declarations from any file in the chain. WIP
Sebastian Redl [Tue, 20 Jul 2010 22:46:15 +0000 (22:46 +0000)]
Allow loading declarations from any file in the chain. WIP

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

14 years agoAllow loading types from any file in the chain. WIP
Sebastian Redl [Tue, 20 Jul 2010 22:37:49 +0000 (22:37 +0000)]
Allow loading types from any file in the chain. WIP

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

14 years agoRemove unintended code that was checked in as part of r108916.
Devang Patel [Tue, 20 Jul 2010 22:32:37 +0000 (22:32 +0000)]
Remove unintended code that was checked in as part of r108916.

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

14 years agoRemove unused argument.
Devang Patel [Tue, 20 Jul 2010 22:20:10 +0000 (22:20 +0000)]
Remove unused argument.

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

14 years agoFix the IR generation for catching pointers by references.
John McCall [Tue, 20 Jul 2010 22:17:55 +0000 (22:17 +0000)]
Fix the IR generation for catching pointers by references.
Fixes <rdar://problem/8212123>.

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

14 years agoin 'new int[4]', constant fold the 4*4=16 instead of
Chris Lattner [Tue, 20 Jul 2010 21:55:52 +0000 (21:55 +0000)]
in 'new int[4]', constant fold the 4*4=16 instead of
doing an overflow check.

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

14 years agoAllow loading source locations from any file in the chain. WIP
Sebastian Redl [Tue, 20 Jul 2010 21:50:20 +0000 (21:50 +0000)]
Allow loading source locations from any file in the chain. WIP

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

14 years agodon't demand names to be on IR.
Chris Lattner [Tue, 20 Jul 2010 21:34:36 +0000 (21:34 +0000)]
don't demand names to be on IR.

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

14 years agotemporarily disable this to fix the build bot.
Chris Lattner [Tue, 20 Jul 2010 21:32:10 +0000 (21:32 +0000)]
temporarily disable this to fix the build bot.

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

14 years agoMore work on getting PCHReader to handle multiple files. Promote SLocOffsets to per...
Sebastian Redl [Tue, 20 Jul 2010 21:20:32 +0000 (21:20 +0000)]
More work on getting PCHReader to handle multiple files. Promote SLocOffsets to per-file data. WIP

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

14 years agoFollow the implementation approach suggested by PR6687,
Chris Lattner [Tue, 20 Jul 2010 21:07:09 +0000 (21:07 +0000)]
Follow the implementation approach suggested by PR6687,
which generates more efficient and more obviously conformant
code.  We now test for overflow of the multiply then force
the result to -1 if so.  On X86, this generates nice code
like this:

__Z4testl:                              ## @_Z4testl
## BB#0:                                ## %entry
subl $12, %esp
movl $4, %eax
mull 16(%esp)
testl %edx, %edx
movl $-1, %ecx
cmovel %eax, %ecx
movl %ecx, (%esp)
call __Znam
addl $12, %esp
ret

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

14 years agoAdopt objc_assign_threadlocal() for __thread variables of GC types.
Fariborz Jahanian [Tue, 20 Jul 2010 20:30:03 +0000 (20:30 +0000)]
Adopt objc_assign_threadlocal() for __thread variables of GC types.
Implements radar 8203301.

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

14 years agoPrint template argument names for template class.
Devang Patel [Tue, 20 Jul 2010 20:24:18 +0000 (20:24 +0000)]
Print template argument names for template class.

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

14 years agoimplement rdar://5739832 - operator new should check for overflow in multiply,
Chris Lattner [Tue, 20 Jul 2010 20:19:24 +0000 (20:19 +0000)]
implement rdar://5739832 - operator new should check for overflow in multiply,
causing clang to compile this code into something that correctly throws a
length error, fixing a potential integer overflow security attack:

void *test(long N) {
  return new int[N];
}

int main() {
  test(1L << 62);
}

We do this even when exceptions are disabled, because it is better for the
code to abort than for the attack to succeed.

This is heavily based on a patch that Fariborz wrote.

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

14 years agoIntroduce a new lexer function to compute the "preamble" of a file,
Douglas Gregor [Tue, 20 Jul 2010 20:18:03 +0000 (20:18 +0000)]
Introduce a new lexer function to compute the "preamble" of a file,
which is the part of the file that contains all of the initial
comments, includes, and preprocessor directives that occur before any
of the actual code. Added a new -print-preamble cc1 action that is
only used for testing.

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

14 years agoUse getDebugLoc and setDebugLoc instead of getDbgMetadata and setDbgMetadata,
Dan Gohman [Tue, 20 Jul 2010 20:13:52 +0000 (20:13 +0000)]
Use getDebugLoc and setDebugLoc instead of getDbgMetadata and setDbgMetadata,
avoiding MDNode overhead.

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

14 years agoHookup checking for invalid length modifiers in scanf format strings.
Ted Kremenek [Tue, 20 Jul 2010 20:04:47 +0000 (20:04 +0000)]
Hookup checking for invalid length modifiers in scanf format strings.

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

14 years agoMove 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.
Ted Kremenek [Tue, 20 Jul 2010 20:04:42 +0000 (20:04 +0000)]
Move 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.

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

14 years agoCleanup whitespace in switch statement. No functionality change.
Ted Kremenek [Tue, 20 Jul 2010 20:04:36 +0000 (20:04 +0000)]
Cleanup whitespace in switch statement.  No functionality change.

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

14 years agoRefactor ScanfConversionSpecifier to subclass ConversionSpecifier.
Ted Kremenek [Tue, 20 Jul 2010 20:04:32 +0000 (20:04 +0000)]
Refactor ScanfConversionSpecifier to subclass ConversionSpecifier.

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

14 years agoAdd 'ConversionSpecifier' root class in 'analyze_format_string' namespace and
Ted Kremenek [Tue, 20 Jul 2010 20:04:27 +0000 (20:04 +0000)]
Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace and
derived 'PrintfConversionSpecifier' from this class.  We will do the same for
'ScanfConversionSpecifier'.

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

14 years agoTidy up analyze_printf::ConversionSpecifier::Kind declaration, prepping it to be...
Ted Kremenek [Tue, 20 Jul 2010 20:04:20 +0000 (20:04 +0000)]
Tidy up analyze_printf::ConversionSpecifier::Kind declaration, prepping it to be merged
with analyze_scanf::ConversionSpecifier::Kind.

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

14 years agoRename 'UnicodeStrArg' to 'SArg'.
Ted Kremenek [Tue, 20 Jul 2010 20:04:15 +0000 (20:04 +0000)]
Rename 'UnicodeStrArg' to 'SArg'.

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

14 years agoRename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf...
Ted Kremenek [Tue, 20 Jul 2010 20:04:10 +0000 (20:04 +0000)]
Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf checking).

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

14 years agoRename 'VoidPtrArg' to 'pArg' in printf/scanf checking.
Ted Kremenek [Tue, 20 Jul 2010 20:04:04 +0000 (20:04 +0000)]
Rename 'VoidPtrArg' to 'pArg' in printf/scanf checking.

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

14 years agoRename 'CStrArg' to 'sArg' for printf checking to match with the analagous enum for...
Ted Kremenek [Tue, 20 Jul 2010 20:03:58 +0000 (20:03 +0000)]
Rename 'CStrArg' to 'sArg' for printf checking to match with the analagous enum for scanf checking.

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

14 years agoRename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to match
Ted Kremenek [Tue, 20 Jul 2010 20:03:49 +0000 (20:03 +0000)]
Rename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to match
analagous enum in analyze_scanf.  This is prep for refactoring the logic for handling
ConversionSpecifiers for both scanf and printf.

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

14 years agoRename diagnostic so that it can be reused with scanf checking. No functionality...
Ted Kremenek [Tue, 20 Jul 2010 20:03:43 +0000 (20:03 +0000)]
Rename diagnostic so that it can be reused with scanf checking.  No functionality change.

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

14 years agodelete a loop that just generates dead code. In an example
Chris Lattner [Tue, 20 Jul 2010 18:49:33 +0000 (18:49 +0000)]
delete a loop that just generates dead code.  In an example
like this:

void *test(long N) {
  return new int[N][42][42];
}

the loop generates two dead mul instructions:

  %tmp = load i64* %N.addr                        ; <i64> [#uses=2]
  %0 = mul i64 %tmp, 7056                         ; <i64> [#uses=1]
  %1 = mul i64 %tmp, 42                           ; <i64> [#uses=1]
  %2 = mul i64 %1, 42                             ; <i64> [#uses=0]
  %call = call noalias i8* @_Znam(i64 %0)         ; <i8*> [#uses=1]

The scale of these multiplies is already handled by the typesize stuff.

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

14 years agoremove the special case for constant array sizes from
Chris Lattner [Tue, 20 Jul 2010 18:45:57 +0000 (18:45 +0000)]
remove the special case for constant array sizes from
EmitCXXNewAllocSize.  This code uses IRBuilder, which does
constant folding already.

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