summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
* Fix PR13148, an inf-loop in StringMap.Chandler Carruth2012-06-191-1/+1
| | | | | | | | | | | | | | | StringMap suffered from the same bug as DenseMap: when you explicitly construct it with a small number of buckets, you can arrange for the tombstone-based growth path to be followed when the number of buckets was less than '8'. In that case, even with a full map, it would compare '0' as not less than '0', and refuse to grow the table, leading to inf-loops trying to find an empty bucket on the next insertion. The fix is very simple: use '<=' as the comparison. The same fix was applied to DenseMap as well during its recent refactoring. Thanks to Alex Bolz for the great report and test case. =] llvm-svn: 158725
* [Support/PathV2] Fix out of bounds access in identify_magic when the file is ↵Michael J. Spencer2012-06-191-0/+2
| | | | | | empty. llvm-svn: 158704
* Don't call 'FilesToRemove[0]' when the vector is empty, even to computeChandler Carruth2012-06-161-1/+1
| | | | | | | the address of it. Found by a checking STL implementation used on a dragonegg builder. Sorry about this one. =/ llvm-svn: 158582
* Harden the Unix signals code to be more async signal safe.Chandler Carruth2012-06-161-9/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is likely only the tip of the ice berg, but this particular bug caused any double-free on a glibc system to turn into a deadlock! It is not generally safe to either allocate or release heap memory from within the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting memory and causing the deadlock. What's worse, eraseFromDisk in PathV1 has lots of allocation and deallocation paths. We even passed 'true' in a place that would have caused the *signal handler* to try to run the 'system' system call and shell out to 'rm -rf'. That was never going to work... This patch switches the file removal to use a vector of strings so that the exact text needed for the 'unlink' system call can be stored there. It switches the loop to be a boring indexed loop, and directly calls unlink without looking at the error. It also works quite hard to ensure that calling 'c_str()' is safe, by ensuring that the non-signal-handling code path that manipulates the vector always leaves it in a state where every element has already had 'c_str()' called at least once. I dunno exactly how overkill this is, but it fixes the deadlock-on-double free issue, and seems likely to prevent any other issues from sneaking up. Sorry for not having a test case, but I *really* don't know how to test signal handling code easily.... llvm-svn: 158580
* Fix building ThreadLocal.cpp with --disable-threads.Argyrios Kyrtzidis2012-06-131-2/+9
| | | | llvm-svn: 158405
* Fixes for PPC host detection and features.Hal Finkel2012-06-121-1/+1
| | | | | | | | | POWER4 is a 64-bit CPU (better matched to the 970). The g3 is really the 750 (no altivec), the g4+ is the 74xx (not the 750). Patch by Andreas Tobler. llvm-svn: 158363
* Reapply r158337, this time properly protect Darwin/PPC host CPU use with ↵Hal Finkel2012-06-121-0/+130
| | | | | | | | | | | | | __ppc__. Original commit message: Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName(). Both the new Linux functionality and the old Darwin functions have been moved. This change also allows this information to be queried directly by clang and other frontends (clang, for example, will now have real -mcpu=native support). llvm-svn: 158349
* Satisfy C++ aliasing rules, per suggestion by Chandler.Argyrios Kyrtzidis2012-06-122-2/+2
| | | | llvm-svn: 158346
* Revert r158337 "Move PPC host-CPU detection logic from PPCSubtarget into ↵Jakob Stoklund Olesen2012-06-121-130/+0
| | | | | | | | | sys::getHostCPUName()." This commit broke most of the PowerPC unit tests when running on Intel/Apple. llvm-svn: 158345
* For llvm::sys::ThreadLocalImpl instead of malloc'ing the platform-specificArgyrios Kyrtzidis2012-06-122-13/+11
| | | | | | | | | | | thread local data, embed them in the class using a uint64_t and make sure we get compiler errors if there's a platform where this is not big enough. This makes ThreadLocal more safe for using it in conjunction with CrashRecoveryContext. Related to crash in rdar://11434201. llvm-svn: 158342
* Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().Hal Finkel2012-06-111-0/+130
| | | | | | | | Both the new Linux functionality and the old Darwin functions have been moved. This change also allows this information to be queried directly by clang and other frontends (clang, for example, will now have real -mcpu=native support). llvm-svn: 158337
* Disabling a spurious deprecation warning about using PathV1 from within the ↵Aaron Ballman2012-06-091-0/+10
| | | | | | PathV1 implementation file. llvm-svn: 158274
* Fixing a typo in the comments.Aaron Ballman2012-06-091-1/+1
| | | | llvm-svn: 158273
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-091-6/+6
| | | | llvm-svn: 158248
* Fix a crash in APInt::lshr when shiftAmt > BitWidth.Chad Rosier2012-06-081-1/+1
| | | | | | Patch by James Benton <jbenton@vmware.com>. llvm-svn: 158213
* Use access(2) instead of stat(2) to check if a file exists.Benjamin Kramer2012-06-021-2/+1
| | | | | | | | | | | Apart from being slightly cheaper, this fixes a real bug that hits 32 bit linux systems. When passing a file larger than 2G to be linked (which isn't that uncommon with large projects such as WebKit), clang's driver checks if the file exists but the file size doesn't fit in an off_t and stat(2) fails with EOVERFLOW. Clang then says that the file doesn't exist instead of passing it to the linker. llvm-svn: 157891
* Path::GetTemporaryDirectory(): Add an assertion if TempDirectory is alive, ↵NAKAMURA Takumi2012-05-271-1/+3
| | | | | | to check when someone would remove the tempdir. llvm-svn: 157529
* Remove the PTX back-end and all of its artifacts (triple, etc.)Justin Holewinski2012-05-241-18/+0
| | | | | | | | This back-end was deprecated in favor of the NVPTX back-end. NV_CONTRIB llvm-svn: 157417
* Fix -Wcovered-switch-default warning.Patrik Hägglund2012-05-241-1/+0
| | | | llvm-svn: 157381
* fix corner case in ConstantRange::intersectWith().Nuno Lopes2012-05-181-1/+1
| | | | | | this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass llvm-svn: 157032
* [Support/YAMLParser] Use rtrim on plain scalars.Michael J. Spencer2012-05-141-3/+1
| | | | llvm-svn: 156787
* [Support/StringRef] Add find_last_not_of and {r,l,}trim.Michael J. Spencer2012-05-111-0/+26
| | | | llvm-svn: 156652
* Allow unique_file to take a mode for file permissions, but defaultEric Christopher2012-05-112-5/+8
| | | | | | | | to user only read/write. Part of rdar://11325849 llvm-svn: 156591
* Set the default iOS version to 3.0.Chad Rosier2012-05-091-2/+4
| | | | llvm-svn: 156492
* Use the cpuid 64 bit flag to pick the default CPU name for an unknown model.Bob Wilson2012-05-091-1/+1
| | | | | | | | | | | For the Family 6 switch in sys::getHostCPUName, an unrecognized model was reported as "i686". That's a really bad default since it means that new CPUs will be treated as if they can only use 32-bit code. This just looks at the cpuid extended feature flag for 64 bit support, and if that is set, it uses a default x86-64 cpu. Similar logic is already used for the Family 15 code. <rdar://problem/11314502> llvm-svn: 156486
* Don't return true on a function with a void return type.Chad Rosier2012-05-091-1/+1
| | | | llvm-svn: 156484
* Add Triple::getiOSVersion.Chad Rosier2012-05-091-0/+21
| | | | | | | This new function provides a way to get the iOS version number from ios triples. Part of rdar://11409204 llvm-svn: 156483
* Fix it so llvm-objdump -arch does accept x86 and x86-64 as valid arch names.Kevin Enderby2012-05-081-0/+41
| | | | | | PR12731. Patch by Meador Inge! llvm-svn: 156444
* [Support] Fix sys::GetRandomNumber() to always use a high quality seed.Daniel Dunbar2012-05-081-5/+15
| | | | llvm-svn: 156414
* Windows/PathV2.inc: Retry rename() for (maximum) 2 seconds.NAKAMURA Takumi2012-05-081-4/+14
| | | | | | Files might be opend by system scanners (eg. file indexer, virus scanner, &c). llvm-svn: 156380
* Don't assume size_t is unsigned long long.Matt Beaumont-Gay2012-05-071-3/+1
| | | | | | Fixes a -Woverflow warning from gcc when building for 32-bit platforms. llvm-svn: 156313
* make SourceMgr tolerate empty SMLoc()'s better.Chris Lattner2012-05-061-45/+54
| | | | llvm-svn: 156260
* Unix/Process.inc: Give more useful random seed to srand. Workaround for PR12743.NAKAMURA Takumi2012-05-061-1/+14
| | | | llvm-svn: 156252
* Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp ↵NAKAMURA Takumi2012-05-062-10/+9
| | | | | | | to Unix/Process.inc. FIXME: GetRandomNumber() is not implemented in Win32. llvm-svn: 156251
* reapply my patch, with a fix for an off-by-one error. Turned out to be a lotChris Lattner2012-05-051-12/+18
| | | | | | of work for a drive-by fix :) llvm-svn: 156246
* revert my patches, which are causing problems.Chris Lattner2012-05-051-18/+12
| | | | llvm-svn: 156245
* refactor some code to expose column numbers more and make diagnostic ↵Chris Lattner2012-05-051-12/+18
| | | | | | printing slightly more efficient. llvm-svn: 156243
* [Support] Add missing include.Daniel Dunbar2012-05-051-1/+2
| | | | llvm-svn: 156240
* [Support] Fix up comments.Daniel Dunbar2012-05-051-5/+3
| | | | llvm-svn: 156239
* [Support] Rewrite sys::fs::unique_file to not be stupid with /dev/urandom.Daniel Dunbar2012-05-051-19/+5
| | | | | | | | - Just use sys::Process::GetRandomNumber instead of having two poor implementations. - This is ~70 times (!) faster on my OS X machine. llvm-svn: 156238
* [Support] Add sys::Process::GetRandomNumber().Daniel Dunbar2012-05-051-0/+9
| | | | | | - Primitive API, but we rarely have need for random numbers. llvm-svn: 156237
* This patch adds a new NVPTX back-end to LLVM which supports code generation ↵Justin Holewinski2012-05-041-0/+18
| | | | | | | | | | | | | | | | | for NVIDIA PTX 3.0. This back-end will (eventually) replace the current PTX back-end, while maintaining compatibility with it. The new target machines are: nvptx (old ptx32) => 32-bit PTX nvptx64 (old ptx64) => 64-bit PTX The sources are based on the internal NVIDIA NVPTX back-end, and contain more functionality than the current PTX back-end currently provides. NV_CONTRIB llvm-svn: 156196
* Change the Intel Atom detection code to recognizePreston Gurd2012-05-021-2/+3
| | | | | | Lincroft and Medfield. llvm-svn: 156025
* YAMLParser: get rid of global ctors & dtors.Benjamin Kramer2012-05-011-2/+0
| | | | llvm-svn: 155907
* [Support/YAMLParser] Fix ASan found bugs.Michael J. Spencer2012-04-271-1/+7
| | | | llvm-svn: 155735
* [Support/YAML] Properly fix unitialized variable warning by inserting aMichael J. Spencer2012-04-261-6/+12
| | | | | | 'REPLACEMENT CHARACTER' (U+FFFD) when getAsInteger fails. llvm-svn: 155653
* Add a missing cpu subtype.Evan Cheng2012-04-231-0/+4
| | | | llvm-svn: 155402
* [Support/Unix] Unconditionally include time.h.Michael J. Spencer2012-04-231-8/+2
| | | | | | | | | | | | When building LLVM on Linux with libc++ with CMake TIME_WITH_SYS_TIME is undefined, and HAVE_SYS_TIME_H is defined. This ends up including sys/time.h but not time.h. Unix/TimeValue.inc requires time.h for asctime_r and localtime. libstdc++ seems to include time.h anyway, but libc++ does not. Fix this by always including time.h llvm-svn: 155382
* Conflict with st_dev/st_ino identifiers under Debian GNU/HurdSylvestre Ledru2012-04-231-4/+4
| | | | | | | | | | | | | The problem is that the struct file_status on UNIX systems has two members called st_dev and st_ino; those are also members of the struct stat, and they are reserved identifiers which can also be provided as #define (and this is the case for st_dev on Hurd). The solution (attached) is to rename them, for example adding a "fs_" prefix (= file status) to them. Patch by Pino Toscano llvm-svn: 155354
* Don't die with an assertion if the Result bitwidth is already correct. ThisChris Lattner2012-04-231-1/+1
| | | | | | fixes an assert reading "1239123123123123" when the result is already 64-bit. llvm-svn: 155329
OpenPOWER on IntegriCloud