Commit Graph

26976 Commits

Author SHA1 Message Date
Zhanyong Wan 8e82c6372a Add an assert() to catch errors using EvalLoad(). Reviewed by kremenek.
llvm-svn: 120073
2010-11-24 01:47:11 +00:00
Ted Kremenek b3b56c6bcd 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.

llvm-svn: 120071
2010-11-24 00:54:37 +00:00
Eli Friedman 9e7baae0c6 Unbreak clang-interpreter. (Should there be some automated testing for this?)
llvm-svn: 120069
2010-11-24 00:32:51 +00:00
Chris Lattner 5ea7d07d2a 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.

llvm-svn: 120066
2010-11-23 22:32:37 +00:00
John McCall 8a1013f8c3 Redeclarations of using declarations are not okay in function scopes.
Not sure what I was thinking before.

Fixes PR8668.

llvm-svn: 120063
2010-11-23 22:03:51 +00:00
Chris Lattner f77e11ba05 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.

llvm-svn: 120062
2010-11-23 21:53:56 +00:00
Chris Lattner 278038b4be hopefully resolve the windows buildbot issue (retch)
llvm-svn: 120061
2010-11-23 21:53:15 +00:00
Chris Lattner dd278430a3 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.

llvm-svn: 120060
2010-11-23 21:17:56 +00:00
Chris Lattner 9624b695d2 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.

llvm-svn: 120056
2010-11-23 20:50:22 +00:00
John McCall feb624a435 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.

llvm-svn: 120055
2010-11-23 20:48:44 +00:00
Peter Collingbourne e57e9ef9b7 Remove static_casts from SemaDeclAttr.cpp
llvm-svn: 120053
2010-11-23 20:45:58 +00:00
Chris Lattner 966b25b938 tidy up code, add a comment about dir caching.
llvm-svn: 120048
2010-11-23 20:30:42 +00:00
Chris Lattner ea61b32c4a replicate a terrible hack to fix a build error on VC++
llvm-svn: 120039
2010-11-23 20:07:39 +00:00
Chris Lattner 8f0583daa2 simplify the cache miss handling code, eliminating CacheMissing.
llvm-svn: 120038
2010-11-23 20:05:15 +00:00
Chris Lattner 5769c3dffd factor the "cache miss" handling code out of FM into a static
method in FileSystemStatCache.

llvm-svn: 120037
2010-11-23 19:56:39 +00:00
Chris Lattner b3c814538b r120013 dropped passing in the precomputed file size to
MemoryBuffer::getFile, causing us to pick up a fstat for
every file.  Restore the optimization.

llvm-svn: 120032
2010-11-23 19:38:22 +00:00
Chris Lattner 2a6fa47b26 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.

llvm-svn: 120031
2010-11-23 19:28:12 +00:00
Chris Lattner 226efd356c rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure.  No 
functionality change.

llvm-svn: 120030
2010-11-23 19:19:34 +00:00
John McCall 20c00e0e7b This test does not need to test the alignment of pointers. Make it pass
on 64-bit systems.

llvm-svn: 120014
2010-11-23 10:15:48 +00:00
Chris Lattner 26b5c190f8 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.

llvm-svn: 120013
2010-11-23 09:19:42 +00:00
Chris Lattner 7219a5db6e don't allow remapping PTH file paths with -fworking-directory, the
client should just pass in absolute paths.

llvm-svn: 120012
2010-11-23 09:01:31 +00:00
Chris Lattner 5631b052c3 reduce indentation and use early outs, to make it easier to read
this code. no functionality change.

llvm-svn: 120011
2010-11-23 08:50:03 +00:00
Chris Lattner 5159f6162e 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.

llvm-svn: 120010
2010-11-23 08:35:12 +00:00
Chris Lattner ec39c9d3d6 make this file be self contained.
llvm-svn: 120008
2010-11-23 08:05:27 +00:00
Chris Lattner 3f5a9efb2d give FileManager a 'FileSystemOptions' ivar, which will be used
to simplify a bunch of code in it.  It should ultimately get inlined
into FileManager.

llvm-svn: 120007
2010-11-23 07:51:02 +00:00
Francois Pichet ce87a7e45c long => int to make the test pass on system where sizeof(long) = 64.
llvm-svn: 120005
2010-11-23 07:15:13 +00:00
Zhanyong Wan 19ec4ee093 Fix a typo in a comment.
llvm-svn: 120004
2010-11-23 06:43:05 +00:00
Chris Lattner 4ac569b2c6 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.

llvm-svn: 120001
2010-11-23 06:09:11 +00:00
Francois Pichet 0c71f6c5d3 Microsoft C anonymous struct implementation.
Documentation: http://msdn.microsoft.com/en-us/library/z2cx9y4f.aspx

llvm-svn: 120000
2010-11-23 06:07:27 +00:00
Chris Lattner 6e6409989f stringref'ize API
llvm-svn: 119997
2010-11-23 04:45:28 +00:00
Chris Lattner 7c434b6937 tidy up
llvm-svn: 119996
2010-11-23 04:40:26 +00:00
Chris Lattner 5df6f8f55f avoid creating sys::Path instances when -fworking-directory isn't being used.
llvm-svn: 119995
2010-11-23 04:33:43 +00:00
Zhanyong Wan 59f09c7483 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.

llvm-svn: 119983
2010-11-22 19:32:14 +00:00
Anders Carlsson 849ea413c6 Refactor the null-initialization for record types and make it handle bases that aren't i8 arrays.
llvm-svn: 119980
2010-11-22 18:42:14 +00:00
Nico Weber ece562ed27 Remove the other FIXME I added. This is covered by the Index test and not testable via -ast-dump.
llvm-svn: 119971
2010-11-22 13:48:02 +00:00
Nico Weber 13c13d4da8 Remove one I just added, add a more focused test for why the current code is correct.
llvm-svn: 119969
2010-11-22 13:12:28 +00:00
Nico Weber 7f8bb368ea Try to get the bots green after r119966.
llvm-svn: 119968
2010-11-22 12:50:03 +00:00
Nico Weber 774303425b Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.
llvm-svn: 119966
2010-11-22 10:30:56 +00:00
Nico Weber 1879bca4c9 Minor whitespace fix, no functionality change
llvm-svn: 119965
2010-11-22 10:26:41 +00:00
NAKAMURA Takumi 3c3b3a7d8b test/Sema/x86-builtin-palignr.c: Now we can remove XFAIL:win32, according to r119958.
llvm-svn: 119961
2010-11-22 09:29:49 +00:00
Zhanyong Wan 6dace61730 Fix PR8419. Reviewed by kremenek and xuzhongxing.
llvm-svn: 119960
2010-11-22 08:45:56 +00:00
Chandler Carruth 45c2fb1e69 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.

llvm-svn: 119958
2010-11-22 08:06:31 +00:00
Anders Carlsson 39a6b22023 Remove FIXME; we don't ever want to lay out empty bases.
llvm-svn: 119957
2010-11-22 00:03:08 +00:00
Anders Carlsson a7dd96ce77 Rename BaseLLVMType to NonVirtualBaseLLVMType.
llvm-svn: 119956
2010-11-21 23:59:45 +00:00
Anders Carlsson e64fbe2a6c Add getCGRecordLayout helper function. No functionality change.
llvm-svn: 119955
2010-11-21 23:56:06 +00:00
Anders Carlsson 4b35e97e74 Update Xcode project.
llvm-svn: 119953
2010-11-21 23:25:35 +00:00
Anders Carlsson a369f8dc3a The 'X' printf type has a valid alternative form. Fixes PR8641.
llvm-svn: 119946
2010-11-21 18:34:21 +00:00
Anders Carlsson 7fb785d449 Update Xcode project.
llvm-svn: 119945
2010-11-21 18:33:34 +00:00
Benjamin Kramer 3959370c92 Fix a bunch of IndirectFieldDecl-related warnings.
- Negative ChainingSize doesn't make sense, make it unsigned.

llvm-svn: 119943
2010-11-21 14:11:41 +00:00
Benjamin Kramer 3cf715d22c Filename.rfind("/\\") won't give us the position of the last directory seperator.
llvm-svn: 119939
2010-11-21 11:32:22 +00:00