]> granicus.if.org Git - clang/log
clang
13 years agoFix 2 problems with Chris Lattner's FileManager redesign on Windows.
Francois Pichet [Wed, 24 Nov 2010 03:07:43 +0000 (03:07 +0000)]
Fix 2 problems with Chris Lattner's FileManager redesign on Windows.

- FileEntry::operator= is needed on Win32.
- There was an error in the S_ISDIR() macro.

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

13 years agoAdd an assert() to catch errors using EvalLoad(). Reviewed by kremenek.
Zhanyong Wan [Wed, 24 Nov 2010 01:47:11 +0000 (01:47 +0000)]
Add an assert() to catch errors using EvalLoad().  Reviewed by kremenek.

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

13 years agoAdjust method calls to reflect name changes in
Ted Kremenek [Wed, 24 Nov 2010 00:54:37 +0000 (00:54 +0000)]
Adjust method calls to reflect name changes in
ImmutableSet/ImmtuableMap/ImmutableList APIs.

Along the way, clean up some method names in
the static analyzer so that they are more
descriptive and/or start with lowercase letters.

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

13 years agoUnbreak clang-interpreter. (Should there be some automated testing for this?)
Eli Friedman [Wed, 24 Nov 2010 00:32:51 +0000 (00:32 +0000)]
Unbreak clang-interpreter. (Should there be some automated testing for this?)

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

13 years agoThe final result of all this refactoring: instead of doing stat immediately
Chris Lattner [Tue, 23 Nov 2010 22:32:37 +0000 (22:32 +0000)]
The final result of all this refactoring: instead of doing stat immediately
followed by an open for every source file we open, probe the file system with
'open' and then do an fstat when it succeeds.  open+fstat is faster than
stat+open because the kernel only has to perform the string->inode mapping
once.  Presumably it gets faster the deeper in your filesystem a lookup
happens.

For -Eonly on cocoa.h, this reduces system time from 0.042s to 0.039s on
my machine, a 7.7% speedup.

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

13 years agoRedeclarations of using declarations are not okay in function scopes.
John McCall [Tue, 23 Nov 2010 22:03:51 +0000 (22:03 +0000)]
Redeclarations of using declarations are not okay in function scopes.
Not sure what I was thinking before.

Fixes PR8668.

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

13 years agoif we succeed in opening a directory but expected a file, ensure we don't
Chris Lattner [Tue, 23 Nov 2010 21:53:56 +0000 (21:53 +0000)]
if we succeed in opening a directory but expected a file, ensure we don't
leak a filedescriptor if a client ever starts returning one.

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

13 years agohopefully resolve the windows buildbot issue (retch)
Chris Lattner [Tue, 23 Nov 2010 21:53:15 +0000 (21:53 +0000)]
hopefully resolve the windows buildbot issue (retch)

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

13 years agochange the 'is directory' indicator to be a null-or-not
Chris Lattner [Tue, 23 Nov 2010 21:17:56 +0000 (21:17 +0000)]
change the 'is directory' indicator to be a null-or-not
pointer that is passed down through the APIs, and make
FileSystemStatCache::get be the one that filters out
directory lookups that hit files.  This also paves the
way to have stat queries be able to return opened files.

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

13 years agopull "is directory" handling into FileManager::getStatValue
Chris Lattner [Tue, 23 Nov 2010 20:50:22 +0000 (20:50 +0000)]
pull "is directory" handling into FileManager::getStatValue
which simplifies clients and is important for future directions.
Add a FD member to FileEntry which isn't used but will be shortly.

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

13 years agoA few tweaks to the value-kind computation:
John McCall [Tue, 23 Nov 2010 20:48:44 +0000 (20:48 +0000)]
A few tweaks to the value-kind computation:
 - Default argument expressions pick up the value kind of the incoming
   expression, not the value kind of the parameter it initializes.
 - When building a template argument for substitution, A::x is an rvalue
   if x is an instance method.
 - Anonymous struct/union paths pick up value kind the same way that
   normal member accesses do;  extract out a common code path for this.

Enable the value-kind assertion, now that it passes self-host.

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

13 years agoRemove static_casts from SemaDeclAttr.cpp
Peter Collingbourne [Tue, 23 Nov 2010 20:45:58 +0000 (20:45 +0000)]
Remove static_casts from SemaDeclAttr.cpp

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

13 years agotidy up code, add a comment about dir caching.
Chris Lattner [Tue, 23 Nov 2010 20:30:42 +0000 (20:30 +0000)]
tidy up code, add a comment about dir caching.

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

13 years agoreplicate a terrible hack to fix a build error on VC++
Chris Lattner [Tue, 23 Nov 2010 20:07:39 +0000 (20:07 +0000)]
replicate a terrible hack to fix a build error on VC++

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

13 years agosimplify the cache miss handling code, eliminating CacheMissing.
Chris Lattner [Tue, 23 Nov 2010 20:05:15 +0000 (20:05 +0000)]
simplify the cache miss handling code, eliminating CacheMissing.

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

13 years agofactor the "cache miss" handling code out of FM into a static
Chris Lattner [Tue, 23 Nov 2010 19:56:39 +0000 (19:56 +0000)]
factor the "cache miss" handling code out of FM into a static
method in FileSystemStatCache.

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

13 years agor120013 dropped passing in the precomputed file size to
Chris Lattner [Tue, 23 Nov 2010 19:38:22 +0000 (19:38 +0000)]
r120013 dropped passing in the precomputed file size to
MemoryBuffer::getFile, causing us to pick up a fstat for
every file.  Restore the optimization.

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

13 years agoPCH files only cache successful stats. Remove the code that reads/writes
Chris Lattner [Tue, 23 Nov 2010 19:28:12 +0000 (19:28 +0000)]
PCH files only cache successful stats.  Remove the code that reads/writes
the result code of the stat to/from the PCH file since it is always 0.

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

13 years agorework the stat cache, pulling it out of FileManager.h into
Chris Lattner [Tue, 23 Nov 2010 19:19:34 +0000 (19:19 +0000)]
rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure.  No
functionality change.

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

13 years agoThis test does not need to test the alignment of pointers. Make it pass
John McCall [Tue, 23 Nov 2010 10:15:48 +0000 (10:15 +0000)]
This test does not need to test the alignment of pointers.  Make it pass
on 64-bit systems.

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

13 years agotidy up. Split FileManager::getBufferForFile into
Chris Lattner [Tue, 23 Nov 2010 09:19:42 +0000 (09:19 +0000)]
tidy up.  Split FileManager::getBufferForFile into
two copies, since they are fundamentally different
operations and the StringRef one should go away
(it shouldn't be part of FileManager at least).

Remove some dead arguments.

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

13 years agodon't allow remapping PTH file paths with -fworking-directory, the
Chris Lattner [Tue, 23 Nov 2010 09:01:31 +0000 (09:01 +0000)]
don't allow remapping PTH file paths with -fworking-directory, the
client should just pass in absolute paths.

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

13 years agoreduce indentation and use early outs, to make it easier to read
Chris Lattner [Tue, 23 Nov 2010 08:50:03 +0000 (08:50 +0000)]
reduce indentation and use early outs, to make it easier to read
this code. no functionality change.

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

13 years agonow the FileManager has a FileSystemOpts ivar, stop threading
Chris Lattner [Tue, 23 Nov 2010 08:35:12 +0000 (08:35 +0000)]
now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code.
This also fixes a latent bug in ASTUnit where it would invoke
methods on FileManager without creating one in some code paths
in cindextext.

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

13 years agomake this file be self contained.
Chris Lattner [Tue, 23 Nov 2010 08:05:27 +0000 (08:05 +0000)]
make this file be self contained.

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

13 years agogive FileManager a 'FileSystemOptions' ivar, which will be used
Chris Lattner [Tue, 23 Nov 2010 07:51:02 +0000 (07:51 +0000)]
give FileManager a 'FileSystemOptions' ivar, which will be used
to simplify a bunch of code in it.  It should ultimately get inlined
into FileManager.

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

13 years agolong => int to make the test pass on system where sizeof(long) = 64.
Francois Pichet [Tue, 23 Nov 2010 07:15:13 +0000 (07:15 +0000)]
long => int to make the test pass on system where sizeof(long) = 64.

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

13 years agoFix a typo in a comment.
Zhanyong Wan [Tue, 23 Nov 2010 06:43:05 +0000 (06:43 +0000)]
Fix a typo in a comment.

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

13 years agoPartially revert Doug's PCH validation patch (r98585).
Chris Lattner [Tue, 23 Nov 2010 06:09:11 +0000 (06:09 +0000)]
Partially revert Doug's PCH validation patch (r98585).

This patch completely defeated the "passing in a prestat'd size
to MemoryBuffer" optimization, leading to an extra fstat call for
every buffer opened, in order to find out if the datestamp and size
of the file on disk matches what is in the stat cache.

I fully admit that I don't completely understand what is going on here:
why punish code when a stat cache isn't in use?  what is the point of a
stat cache if you have to turn around and stat stuff to validate it?

To resolve both these issues, just drop the modtime check and check the
file size, which is the important thing anyway.  This should also resolve
PR6812, because presumably windows is stable when it comes to file sizes.
If the modtime is actually important, we should get it and keep it on the
first stat.

This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up
system time on -Eonly Cocoa.h  from 0.041 to 0.038s.

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

13 years agoMicrosoft C anonymous struct implementation.
Francois Pichet [Tue, 23 Nov 2010 06:07:27 +0000 (06:07 +0000)]
Microsoft C anonymous struct implementation.
Documentation: http://msdn.microsoft.com/en-us/library/z2cx9y4f.aspx

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

13 years agostringref'ize API
Chris Lattner [Tue, 23 Nov 2010 04:45:28 +0000 (04:45 +0000)]
stringref'ize API

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

13 years agotidy up
Chris Lattner [Tue, 23 Nov 2010 04:40:26 +0000 (04:40 +0000)]
tidy up

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

13 years agoavoid creating sys::Path instances when -fworking-directory isn't being used.
Chris Lattner [Tue, 23 Nov 2010 04:33:43 +0000 (04:33 +0000)]
avoid creating sys::Path instances when -fworking-directory isn't being used.

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

13 years agoStylistic changes to CFG.cpp:
Zhanyong Wan [Mon, 22 Nov 2010 19:32:14 +0000 (19:32 +0000)]
Stylistic changes to CFG.cpp:

1. "no 'else' after 'return'" -- this is for conformance with the
coding standards.

2. move 'else' to the line of the previous '}' -- this is for consistency.

Reviewed by kremenek.

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

13 years agoRefactor the null-initialization for record types and make it handle bases that aren...
Anders Carlsson [Mon, 22 Nov 2010 18:42:14 +0000 (18:42 +0000)]
Refactor the null-initialization for record types and make it handle bases that aren't i8 arrays.

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

13 years agoRemove the other FIXME I added. This is covered by the Index test and not testable...
Nico Weber [Mon, 22 Nov 2010 13:48:02 +0000 (13:48 +0000)]
Remove the other FIXME I added. This is covered by the Index test and not testable via -ast-dump.

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

13 years agoRemove one I just added, add a more focused test for why the current code is correct.
Nico Weber [Mon, 22 Nov 2010 13:12:28 +0000 (13:12 +0000)]
Remove one I just added, add a more focused test for why the current code is correct.

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

13 years agoTry to get the bots green after r119966.
Nico Weber [Mon, 22 Nov 2010 12:50:03 +0000 (12:50 +0000)]
Try to get the bots green after r119966.

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

13 years agoFix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.
Nico Weber [Mon, 22 Nov 2010 10:30:56 +0000 (10:30 +0000)]
Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.

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

13 years agoMinor whitespace fix, no functionality change
Nico Weber [Mon, 22 Nov 2010 10:26:41 +0000 (10:26 +0000)]
Minor whitespace fix, no functionality change

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

13 years agotest/Sema/x86-builtin-palignr.c: Now we can remove XFAIL:win32, according to r119958.
NAKAMURA Takumi [Mon, 22 Nov 2010 09:29:49 +0000 (09:29 +0000)]
test/Sema/x86-builtin-palignr.c: Now we can remove XFAIL:win32, according to r119958.

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

13 years agoFix PR8419. Reviewed by kremenek and xuzhongxing.
Zhanyong Wan [Mon, 22 Nov 2010 08:45:56 +0000 (08:45 +0000)]
Fix PR8419.  Reviewed by kremenek and xuzhongxing.

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

13 years agoUndo part of my previous commit to mm_malloc.h, going back to the use of
Chandler Carruth [Mon, 22 Nov 2010 08:06:31 +0000 (08:06 +0000)]
Undo part of my previous commit to mm_malloc.h, going back to the use of
stdlib.h. There were numerous problems with forward declaring 'malloc' and
'free', but the most important is that these are reserved by POSIX and may be
implemented via a function-like macro.

As suggested by Dale Johannesen, I'm instead guarding the only include of this
in our builtin headers with __STDC_HOSTED__, and I've removed the include of
the header from the test suite. I'll discuss with folks whether we want to have
a hosted section of the test suite or not, and add it (and perhaps other tests)
back there if that's the direction.

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

13 years agoRemove FIXME; we don't ever want to lay out empty bases.
Anders Carlsson [Mon, 22 Nov 2010 00:03:08 +0000 (00:03 +0000)]
Remove FIXME; we don't ever want to lay out empty bases.

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

13 years agoRename BaseLLVMType to NonVirtualBaseLLVMType.
Anders Carlsson [Sun, 21 Nov 2010 23:59:45 +0000 (23:59 +0000)]
Rename BaseLLVMType to NonVirtualBaseLLVMType.

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

13 years agoAdd getCGRecordLayout helper function. No functionality change.
Anders Carlsson [Sun, 21 Nov 2010 23:56:06 +0000 (23:56 +0000)]
Add getCGRecordLayout helper function. No functionality change.

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

13 years agoUpdate Xcode project.
Anders Carlsson [Sun, 21 Nov 2010 23:25:35 +0000 (23:25 +0000)]
Update Xcode project.

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

13 years agoThe 'X' printf type has a valid alternative form. Fixes PR8641.
Anders Carlsson [Sun, 21 Nov 2010 18:34:21 +0000 (18:34 +0000)]
The 'X' printf type has a valid alternative form. Fixes PR8641.

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

13 years agoUpdate Xcode project.
Anders Carlsson [Sun, 21 Nov 2010 18:33:34 +0000 (18:33 +0000)]
Update Xcode project.

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

13 years agoFix a bunch of IndirectFieldDecl-related warnings.
Benjamin Kramer [Sun, 21 Nov 2010 14:11:41 +0000 (14:11 +0000)]
Fix a bunch of IndirectFieldDecl-related warnings.

- Negative ChainingSize doesn't make sense, make it unsigned.

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

13 years agoFilename.rfind("/\\") won't give us the position of the last directory seperator.
Benjamin Kramer [Sun, 21 Nov 2010 11:32:22 +0000 (11:32 +0000)]
Filename.rfind("/\\") won't give us the position of the last directory seperator.

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

13 years agoremove old compatibility APIs, use StringRef versions instead.
Chris Lattner [Sun, 21 Nov 2010 09:55:08 +0000 (09:55 +0000)]
remove old compatibility APIs, use StringRef versions instead.

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

13 years agochange the various getFile routines to use StringRef as their implementation form.
Chris Lattner [Sun, 21 Nov 2010 09:50:16 +0000 (09:50 +0000)]
change the various getFile routines to use StringRef as their implementation form.

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

13 years agoFix warning: enumeration value 'IndirectField' not handled in switch.
Francois Pichet [Sun, 21 Nov 2010 06:49:41 +0000 (06:49 +0000)]
Fix warning: enumeration value 'IndirectField' not handled in switch.

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

13 years agoCompilation error: remove extra comma.
Francois Pichet [Sun, 21 Nov 2010 06:22:53 +0000 (06:22 +0000)]
Compilation error: remove extra comma.

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

13 years agoMajor anonymous union/struct redesign.
Francois Pichet [Sun, 21 Nov 2010 06:08:52 +0000 (06:08 +0000)]
Major anonymous union/struct redesign.
A new AST node is introduced:
   def IndirectField : DDecl<Value>;
IndirectFields are injected into the anonymous's parent scope and chain back to
the original field. Name lookup for anonymous entities now result in an
IndirectFieldDecl instead of a FieldDecl.
There is no functionality change, the code generated should be the same.

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

13 years agoForward the -fno-elide-constructor argument to clang -cc1. Fixes PR8652.
Anders Carlsson [Sun, 21 Nov 2010 00:09:52 +0000 (00:09 +0000)]
Forward the -fno-elide-constructor argument to clang -cc1. Fixes PR8652.

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

13 years agoAdd comments.
Zhongxing Xu [Sat, 20 Nov 2010 08:17:16 +0000 (08:17 +0000)]
Add comments.

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

13 years agoFix a typo in EnvironmentManager::bindExprAndLocation(). Reviewed by kremenek.
Zhanyong Wan [Sat, 20 Nov 2010 07:52:48 +0000 (07:52 +0000)]
Fix a typo in EnvironmentManager::bindExprAndLocation(). Reviewed by kremenek.

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

13 years agoHandle CFGAutomaticObjDtor.
Zhongxing Xu [Sat, 20 Nov 2010 06:53:12 +0000 (06:53 +0000)]
Handle CFGAutomaticObjDtor.

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

13 years agoRevert r119838 "Don't warn for empty 'if' body if there is a macro that expands to...
Argyrios Kyrtzidis [Sat, 20 Nov 2010 02:04:01 +0000 (02:04 +0000)]
Revert r119838 "Don't warn for empty 'if' body if there is a macro that expands to nothing"
and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro.

Thanks to Abramo Bagnara for the hint!

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

13 years agoA bundle of whitespace changes, separated out from the functional changes.
Nick Lewycky [Sat, 20 Nov 2010 01:29:55 +0000 (01:29 +0000)]
A bundle of whitespace changes, separated out from the functional changes.

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

13 years agoImplement a simple hash function for libclang cursors
Douglas Gregor [Sat, 20 Nov 2010 00:09:34 +0000 (00:09 +0000)]
Implement a simple hash function for libclang cursors

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

13 years agoImplement clang_getCanonicalCursor() in libclang, which does the obvious thing.
Douglas Gregor [Fri, 19 Nov 2010 23:44:15 +0000 (23:44 +0000)]
Implement clang_getCanonicalCursor() in libclang, which does the obvious thing.

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

13 years agoSeveral PPCallbacks take an SourceLocation + IdentifierInfo, rather
Craig Silverstein [Fri, 19 Nov 2010 21:33:15 +0000 (21:33 +0000)]
Several PPCallbacks take an SourceLocation + IdentifierInfo, rather
than a Token that holds the same information all in one easy-to-use
package.  There's no technical reason to prefer the former -- the
information comes from a Token originally -- and it's clumsier to use,
so I've changed the code to use tokens everywhere.

Approved by clattner

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

13 years agoCheck for gcc 4.3.4.
Rafael Espindola [Fri, 19 Nov 2010 21:02:06 +0000 (21:02 +0000)]
Check for gcc 4.3.4.

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

13 years agoDon't warn for empty 'if' body if there is a macro that expands to nothing, e.g:
Argyrios Kyrtzidis [Fri, 19 Nov 2010 20:54:25 +0000 (20:54 +0000)]
Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:

  if (condition)
    CALL(0); // empty macro but don't warn for empty body.

Fixes rdar://8436021.

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

13 years agoMake sure to print cvr-qualifiers on function declarations
Douglas Gregor [Fri, 19 Nov 2010 18:44:34 +0000 (18:44 +0000)]
Make sure to print cvr-qualifiers on function declarations

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

13 years agoMinor cleanup. No change otherwise.
Fariborz Jahanian [Fri, 19 Nov 2010 18:17:09 +0000 (18:17 +0000)]
Minor cleanup. No change otherwise.

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

13 years agoobjc_msgSend is not a builtin type in non-objc mode.
Fariborz Jahanian [Fri, 19 Nov 2010 18:16:46 +0000 (18:16 +0000)]
objc_msgSend is not a builtin type in non-objc mode.
Fixes //rdar://8686888

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

13 years agoDriver/Darwin: Don't pass -demangle to an iOS linker, which may not understand
Daniel Dunbar [Fri, 19 Nov 2010 17:51:40 +0000 (17:51 +0000)]
Driver/Darwin: Don't pass -demangle to an iOS linker, which may not understand
it.

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

13 years agoInitialize StoredDiagnostic's members in order.
Benjamin Kramer [Fri, 19 Nov 2010 17:36:51 +0000 (17:36 +0000)]
Initialize StoredDiagnostic's members in order.

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

13 years agoadd support for the i686-pc-linux-gnu triple (used by Gentoo x86)
Nuno Lopes [Fri, 19 Nov 2010 17:26:57 +0000 (17:26 +0000)]
add support for the i686-pc-linux-gnu triple (used by Gentoo x86)

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

13 years agoWhen parsing something that looks like an ill-formed
Douglas Gregor [Fri, 19 Nov 2010 17:10:50 +0000 (17:10 +0000)]
When parsing something that looks like an ill-formed
protocol-qualifier list without a leading type (e.g., <#blah#>), don't
complain about it being an archaic protocol-qualifier list unless it
actually parses as one.

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

13 years agoDriver: Ignore -force_cpusubtype_ALL.
Daniel Dunbar [Fri, 19 Nov 2010 16:23:35 +0000 (16:23 +0000)]
Driver: Ignore -force_cpusubtype_ALL.

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

13 years agoExtend the libclang diagnostic API to provide information about the
Douglas Gregor [Fri, 19 Nov 2010 16:18:16 +0000 (16:18 +0000)]
Extend the libclang diagnostic API to provide information about the
option name, category ID, and category name corresponding to a diagnostic.

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

13 years agoRemove Diagnostic's get/setNumErrors() and getNumErrorsSuppressed().
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:20 +0000 (00:19 +0000)]
Remove Diagnostic's get/setNumErrors() and getNumErrorsSuppressed().

Anyone wanting to use it should probably use DiagnosticClient's getNumErrors() instead.

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

13 years agogetNumErrors() -> hasErrorOccurred()
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:18 +0000 (00:19 +0000)]
getNumErrors() -> hasErrorOccurred()

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

13 years agoRefactoring. Get FunctionScopeInfo to use DiagnosticErrorTrap.
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:15 +0000 (00:19 +0000)]
Refactoring. Get FunctionScopeInfo to use DiagnosticErrorTrap.

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

13 years agoRefactoring.
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:12 +0000 (00:19 +0000)]
Refactoring.
Move ErrorTrap from clang/Sema to clang/Basic as DiagnosticErrorTrap and use it in Scope.

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

13 years agoFix a bug where write-barriers for assignment through reference
Fariborz Jahanian [Thu, 18 Nov 2010 22:39:16 +0000 (22:39 +0000)]
Fix a bug where write-barriers for assignment through reference
types was not being generated for objc pointers.
// rdar://8681766.

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

13 years agoUse a signed vector type for the shift amount operand of unsigned shifts.
Bob Wilson [Thu, 18 Nov 2010 21:51:10 +0000 (21:51 +0000)]
Use a signed vector type for the shift amount operand of unsigned shifts.
Neon shifts allow a mix of positive and negative shift amounts to shift
left or right, respectively, so the shift amount vector should always be
signed.  PR8482 (Radar 8603521).

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

13 years agoUse hasErrorOccurred() instead of getNumErrors() where it makes sense.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:47:07 +0000 (21:47 +0000)]
Use hasErrorOccurred() instead of getNumErrors() where it makes sense.

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

13 years agoGet the number of errors reported from the diagnostic client, in clang_parseTranslati...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:47:04 +0000 (21:47 +0000)]
Get the number of errors reported from the diagnostic client, in clang_parseTranslationUnit_Impl.

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

13 years agoUpdate CMake build.
Benjamin Kramer [Thu, 18 Nov 2010 21:19:52 +0000 (21:19 +0000)]
Update CMake build.

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

13 years agoRemove the hack where, to get the return status, we had special case for VerifyDiagno...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:13:57 +0000 (21:13 +0000)]
Remove the hack where, to get the return status, we had special case for VerifyDiagnosticsClient
and just check the number of errors from the DiagnosticClient.

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

13 years agoKeep track of errors/warnings in FixItRewriter.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:13:54 +0000 (21:13 +0000)]
Keep track of errors/warnings in FixItRewriter.

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

13 years agoSince multiple diagnostics can share one diagnostic client, have the client keeping...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 20:06:46 +0000 (20:06 +0000)]
Since multiple diagnostics can share one diagnostic client, have the client keeping track
of the total number of warnings/errors reported.

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

13 years agoRefactoring of Diagnostic class.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 20:06:41 +0000 (20:06 +0000)]
Refactoring of Diagnostic class.

-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

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

13 years agoCopy the LangOptions in PrintingPolicy to avoid pointing to a LangOptions that is...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 20:06:30 +0000 (20:06 +0000)]
Copy the LangOptions in PrintingPolicy to avoid pointing to a LangOptions that is long gone.

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

13 years agoAdd an assertion, fix a whole bunch of bugs, comment the assertion
John McCall [Thu, 18 Nov 2010 19:01:18 +0000 (19:01 +0000)]
Add an assertion, fix a whole bunch of bugs, comment the assertion
out because there are still bugs left.

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

13 years agoRemove the getDiagnosticLevel check since it doesn't buy us much.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 18:51:03 +0000 (18:51 +0000)]
Remove the getDiagnosticLevel check since it doesn't buy us much.

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

13 years agoFix a typo in the UTF-8 BOM (PR8645). Use a StringSwitch while at it.
Benjamin Kramer [Thu, 18 Nov 2010 12:46:39 +0000 (12:46 +0000)]
Fix a typo in the UTF-8 BOM (PR8645). Use a StringSwitch while at it.

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

13 years agoIn some situations, TemplateArgumentLoc wasn't setting TypeSourceLoc (see
Craig Silverstein [Thu, 18 Nov 2010 08:32:02 +0000 (08:32 +0000)]
In some situations, TemplateArgumentLoc wasn't setting TypeSourceLoc (see
http://llvm.org/bugs/show_bug.cgi?id=8558).  This patch fixes it.  Thanks to
rjmccall for all the coaching!

Approved by rjmccall

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

13 years agoCalculate the value kind of an expression when it's created and
John McCall [Thu, 18 Nov 2010 06:31:45 +0000 (06:31 +0000)]
Calculate the value kind of an expression when it's created and
store it on the expression node.  Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.

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

13 years agoAdded method for handling CXXOperatorCallExpr differently from CallExpr if CXXOperato...
Marcin Swiderski [Thu, 18 Nov 2010 06:29:23 +0000 (06:29 +0000)]
Added method for handling CXXOperatorCallExpr differently from CallExpr if CXXOperatorCallExpr represents method call.
Also fixed returning ExpolodedNodeSet from VisitCXXMethodCallExpr.

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

13 years agocomparison of AltiVec vectors now gives bool result (fix for 7533)
Anton Yartsev [Thu, 18 Nov 2010 03:19:30 +0000 (03:19 +0000)]
comparison of AltiVec vectors now gives bool result (fix for 7533)

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

13 years agoCursorVisitor: switch remaining expressions over
Ted Kremenek [Thu, 18 Nov 2010 00:42:18 +0000 (00:42 +0000)]
CursorVisitor: switch remaining expressions over
to the data-recursion algorithm.  CursorVisitor
now no longer subclasses StmtVisitor.

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

13 years ago-Rename -Wargument-larger-than -> -Wlarge-by-value-copy
Argyrios Kyrtzidis [Thu, 18 Nov 2010 00:20:36 +0000 (00:20 +0000)]
-Rename -Wargument-larger-than -> -Wlarge-by-value-copy
-Improve the diagnostic message
-Add some comments

Suggestions by Chris.

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

13 years agoCursorVisitor: migrate handling of
Ted Kremenek [Thu, 18 Nov 2010 00:02:32 +0000 (00:02 +0000)]
CursorVisitor: migrate handling of
'DependentScopeDeclRefExpr' and
'CXXDependentScopeMemberExpr' to the
data-recursion algorithm.

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