summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
Commit message (Collapse)AuthorAgeFilesLines
...
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-252-4/+4
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-231-2/+2
| | | | | | Mulder! llvm-svn: 135855
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-2311-106/+107
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Define the _MIPS_SIM builtin macro on MIPS platforms. Patch by Robert Millan!Bruno Cardoso Lopes2011-07-211-1/+19
| | | | llvm-svn: 135675
* Refactor r135502 to avoid an empty if else condition, per Eric's suggestion ↵Chad Rosier2011-07-191-4/+8
| | | | | | (good call!). llvm-svn: 135510
* Clang asserts "Invalid environment!" when using -ccc-host-triple Chad Rosier2011-07-191-0/+4
| | | | | | | | arch-pc-win32-macho (e.g., x86_64-pc-win32-macho), which appears to be a false positive. rdar://9786307 llvm-svn: 135502
* Revamp the SourceManager to separate the representation of parsedDouglas Gregor2011-07-192-170/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | source locations from source locations loaded from an AST/PCH file. Previously, loading an AST/PCH file involved carefully pre-allocating space at the beginning of the source manager for the source locations and FileIDs that correspond to the prefix, and then appending the source locations/FileIDs used for parsing the remaining translation unit. This design forced us into loading PCH files early, as a prefix, whic has become a rather significant limitation. This patch splits the SourceManager space into two parts: for source location "addresses", the lower values (growing upward) are used to describe parsed code, while upper values (growing downward) are used for source locations loaded from AST/PCH files. Similarly, positive FileIDs are used to describe parsed code while negative FileIDs are used to file/macro locations loaded from AST/PCH files. As a result, we can load PCH/AST files even during parsing, making various improvemnts in the future possible, e.g., teaching #include <foo.h> to look for and load <foo.h.gch> if it happens to be already available. This patch was originally written by Sebastian Redl, then brought forward to the modern age by Jonathan Turner, and finally polished/finished by me to be committed. llvm-svn: 135484
* simplifyChris Lattner2011-07-141-1/+1
| | | | llvm-svn: 135170
* StringMap::first() is about to start returning a StringRef, adapt.Chris Lattner2011-07-141-1/+2
| | | | llvm-svn: 135166
* Disable avx feature from corei7-avx, and use -mavx for now. Right now, if ↵Bruno Cardoso Lopes2011-07-111-1/+1
| | | | | | | | | -mavx is specified, 128 avx code is used and we're not sure yet if this the behavior we want (and if it does, some improvements are needed before relying on it). llvm-svn: 134939
* Enable "avx" feature, so it can be seen by llvmBruno Cardoso Lopes2011-07-111-1/+1
| | | | llvm-svn: 134935
* Apply patch from Richard Trieu to fix PR9548:Chandler Carruth2011-07-111-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two different types has the same text representation in the same diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra information about the type. class versa_string; typedef versa_string string; namespace std {template <typename T> class vector;} using std::vector; void f(vector<string> v); namespace std { class basic_string; typedef basic_string string; template <typename T> class vector {}; void g() { vector<string> v; f(v); } } Old message: ---------------- test.cc:15:3: error: no matching function for call to 'f' f(&v); ^ test.cc:7:6: note: candidate function not viable: no known conversion from 'vector<string>' to 'vector<string>' for 1st argument void f(vector<string> v); ^ 1 error generated. New message: --------------- test.cc:15:3: error: no matching function for call to 'f' f(v); ^ test.cc:7:6: note: candidate function not viable: no known conversion from 'vector<string>' (aka 'std::vector<std::basic_string>') to 'vector<string>' (aka 'std::vector<versa_string>') for 1st argument void f(vector<string> v); ^ 1 error generated. llvm-svn: 134904
* Change -mno-mmx to be more compatible with gcc. Specifically, -mno-mmx ↵Eli Friedman2011-07-081-37/+53
| | | | | | | | | | | | should not imply -mno-sse. Note that because we don't usually touch the MMX registers anyway, all -mno-mmx needs to do is tweak the x86-32 calling convention a little for vectors that look like MMX vectors, and prevent the definition of __MMX__. clang doesn't actually stop the user from using MMX inline asm operands or MMX builtins in -mno-mmx mode; as a QOI issue, it would be nice to diagnose, but I doubt it really matters much. <rdar://problem/9694837> llvm-svn: 134770
* Fix a FIXME in clang ARM driver that was exposed as a bug with ARM backendEvan Cheng2011-07-081-11/+2
| | | | | | | | | | | | | change. Previously clang was passing the following feature strings to the ARM backend when CPU is cortex-a8: +neon,-vfp2,-vfp3 This used to work because -vfp2,-vfp3 had no effect after +neon. Now that the features are controlled by individual bits (with implied hierarchy), the net effect is all three features will be turned off. llvm-svn: 134691
* Keep track of which source locations are part of a macro argumentChandler Carruth2011-07-071-4/+27
| | | | | | | | | | | | | | | | | | | | instantiation and improve diagnostics which are stem from macro arguments to trace the argument itself back through the layers of macro expansion. This requires some tricky handling of the source locations, as the argument appears to be expanded in the opposite direction from the surrounding macro. This patch provides helper routines that encapsulate the logic and explain the reasoning behind how we step through macros during diagnostic printing. This fixes the rest of the test cases originially in PR9279, and later split out into PR10214 and PR10215. There is still some more work we can do here to improve the macro backtrace, but those will follow as separate patches. llvm-svn: 134660
* Fix a typo in the fpsr register and add the fpcr register.Eric Christopher2011-07-071-5/+5
| | | | | | Fixes PR10299 and rdar://9740322 llvm-svn: 134654
* Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the ↵Argyrios Kyrtzidis2011-07-071-55/+0
| | | | | | Lexer, since they depend on it now. llvm-svn: 134644
* FreeBSD gets FreeBSD target, just mipsel.Joerg Sonnenberger2011-07-071-1/+1
| | | | llvm-svn: 134619
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-52/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) llvm-svn: 134587
* Fix bug in SourceManager::getDecomposedInstantiationLocSlowCase.Argyrios Kyrtzidis2011-07-071-3/+4
| | | | | | | | | | | | | It would add up relative (decomposed) offsets like in getDecomposedSpellingLocSlowCase, but while it makes sense to preserve the offset among lexed spelling locations, it doesn't make sense to add anything to the offset of the instantiation location. The instantiation location will be the same regardless of the relative offset in the tokens that were instantiated. This bug didn't actually affect anything because, currently, in practice we never create macro locations with relative offset greater than 0. llvm-svn: 134586
* For -print-stats, add the number of bytes that SLocEntryTable consumes.Argyrios Kyrtzidis2011-07-071-1/+3
| | | | llvm-svn: 134585
* Keep track of when "unrecoverable" errors occur, then allowDouglas Gregor2011-07-062-3/+7
| | | | | | | clang_saveTranslationUnit() to save a PCH file if the only errors it contains are recoverable errors. Fixes <rdar://problem/9727804>. llvm-svn: 134503
* SmallVectorize a critical vector.Benjamin Kramer2011-07-061-1/+1
| | | | | | | The small number of elements was determined by taking the median file length in clang+llvm and /usr/include on OS X with xcode installed. llvm-svn: 134496
* Fix C&P errorJoerg Sonnenberger2011-07-061-1/+1
| | | | llvm-svn: 134490
* objc-arc: enforce performSelector rules in rejecting retaining selectorsFariborz Jahanian2011-07-051-0/+2
| | | | | | | passed to it, and unknown selectors causing potential leak. // rdar://9659270 llvm-svn: 134449
* Remove unused member of Builtin::Info.Eli Friedman2011-07-052-23/+15
| | | | llvm-svn: 134443
* Hook up mipsel-netbsd and mipsel-freebsd for OS specific handling.Joerg Sonnenberger2011-07-051-4/+11
| | | | llvm-svn: 134425
* Use OS-specific configuration for mips-netbsd and mips-freebsd.Joerg Sonnenberger2011-07-051-4/+11
| | | | llvm-svn: 134422
* Don't define _BIG_ENDIAN for NetBSD/PowerPC.Joerg Sonnenberger2011-07-051-1/+2
| | | | llvm-svn: 134411
* Fix indentationJoerg Sonnenberger2011-07-051-3/+3
| | | | llvm-svn: 134410
* Add explicit default case for -Wswitch-enum.Joerg Sonnenberger2011-07-041-0/+2
| | | | llvm-svn: 134399
* Use switch(os) style consistently. Add a bunch of NetBSD branches.Joerg Sonnenberger2011-07-041-10/+27
| | | | llvm-svn: 134393
* On PowerPC, both FreeBSD and NetBSD use ints for (s)size_tJoerg Sonnenberger2011-07-041-1/+5
| | | | llvm-svn: 134392
* Update for llvm commit r134291.Eric Christopher2011-07-021-1/+2
| | | | | | Fixes rdar://9714064 llvm-svn: 134292
* Add initial *-*-rtems* target, from Joel SherrillDouglas Gregor2011-07-011-0/+73
| | | | llvm-svn: 134283
* Use preferred 64-bit alignment for i64 & f64 for Thumb targets. Radar 9695134.Bob Wilson2011-06-291-1/+1
| | | | llvm-svn: 134070
* Split out logic for valid clobbers and valid inline asm registers.Eric Christopher2011-06-281-3/+8
| | | | | | Fixes rdar://9281377 llvm-svn: 134016
* SourceManager::isAtStartOfMacroInstantiation should check not only if the ↵Argyrios Kyrtzidis2011-06-241-1/+5
| | | | | | | | location is at the first token but that the location's offset is not inside the token as well. llvm-svn: 133800
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-4/+4
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Move additional register names to their own lookup, separate fromEric Christopher2011-06-212-13/+45
| | | | | | | | register aliases. Fixes unnecessary renames of clobbers. Fixes part of rdar://9425559 llvm-svn: 133485
* As a hopefully temporary workaround for a header mistake, treatJohn McCall2011-06-171-0/+1
| | | | | | __bridge_retain as a synonym for __bridge_retained. llvm-svn: 133295
* Add some more memory constraints for ARM.Eric Christopher2011-06-171-0/+6
| | | | | | Part of rdar://9197685 llvm-svn: 133225
* On ARM make sure that we continue translating 'p' to 'r' for theEric Christopher2011-06-171-0/+3
| | | | | | | | constraints. rdar://9618597 llvm-svn: 133222
* Stylistic fix: move virtual keyword before return type.Evan Cheng2011-06-161-2/+1
| | | | llvm-svn: 133181
* Unconditionally #define the ARC ownership qualifiers, instead of #definingJohn McCall2011-06-161-8/+1
| | | | | | them only on Darwin tool chains. llvm-svn: 133112
* Automatic Reference Counting.John McCall2011-06-153-10/+38
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Generate enumerators for diagnostic categories. Patch by Argyrios!John McCall2011-06-151-1/+23
| | | | | | Depends on LLVM r133093. llvm-svn: 133094
* StaticDiagNameIndex is never written to, place it into .rodata.Benjamin Kramer2011-06-141-2/+2
| | | | llvm-svn: 132990
* Put classes into anonymous namespaces.Benjamin Kramer2011-06-131-20/+26
| | | | llvm-svn: 132924
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
OpenPOWER on IntegriCloud