summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* [arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.Argyrios Kyrtzidis2011-07-091-1/+13
| | | | | | | | | | | | | | | | | | | | This is a new mode of migration, where we avoid modifying the original files but we emit temporary files instead. <path> will be used to keep migration process metadata. Currently the temporary files that are produced are put in the system's temp directory but we can put them in the <path> if is necessary. Also introduce new ARC migration functions in libclang whose only purpose, currently, is to accept <path> and provide pairs of original file/transformed file to map from the originals to the files after transformations are applied. Finally introduce the c-arcmt-test utility that exercises the new libclang functions, update arcmt-test, and add tests for the whole process. rdar://9735086. llvm-svn: 134844
* Fix up dependency file name printing to more closely match that of gcc, ↵Eli Friedman2011-07-081-5/+11
| | | | | | | | including fixing a nasty recent regression that could make us print "/foo.h" with a command-line including "-I ./". rdar://problem/9734352 llvm-svn: 134728
* Keep track of which source locations are part of a macro argumentChandler Carruth2011-07-071-13/+83
| | | | | | | | | | | | | | | | | | | | 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
* Remove BoostCon-specific code from Clang. FWIW, I'm a fan of things like ↵Jonathan D. Turner2011-07-073-43/+0
| | | | | | this living in a separate branch. llvm-svn: 134649
* Introduce a new libclang aPI function,Douglas Gregor2011-07-071-16/+30
| | | | | | | | | clang_codeCompleteGetContexts(), that provides the client with information about the context in which code completion has occurred and what kinds of entities make sense as completions at that point. Patch by Connor Wakamo! llvm-svn: 134615
* Keep track of when "unrecoverable" errors occur, then allowDouglas Gregor2011-07-061-1/+1
| | | | | | | clang_saveTranslationUnit() to save a PCH file if the only errors it contains are recoverable errors. Fixes <rdar://problem/9727804>. llvm-svn: 134503
* libclang: Allow callers of clang_saveTranslationUnit() to distinguishDouglas Gregor2011-07-061-4/+4
| | | | | | | between different classes of errors. Addresses most of <rdar://problem/9660328>. llvm-svn: 134495
* Call objc_terminate() instead of abort() when a cleanup throws anJohn McCall2011-07-061-0/+3
| | | | | | | exception in Objective-C; in Objective-C++ we still use std::terminate(). This is only available in very recent runtimes. llvm-svn: 134456
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-062-6/+10
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Don't define __CONSTANT_CFSTRINGS__ with -fno-constant-cfstrings issue.Fariborz Jahanian2011-07-051-1/+2
| | | | | | Patch by Jean-Daniel Dupas. llvm-svn: 134414
* Update header-search paths for MinGW, from Ruben Van BoxemDouglas Gregor2011-07-051-0/+2
| | | | llvm-svn: 134406
* Make the GCC version proliferation worse by N+1 for the sake ofChandler Carruth2011-07-021-0/+4
| | | | | | ArchLinux. =/ Fixes PR10246. llvm-svn: 134299
* Add initial *-*-rtems* target, from Joel SherrillDouglas Gregor2011-07-011-1/+4
| | | | llvm-svn: 134283
* When we create a precompiled preamble, don't copy theDouglas Gregor2011-07-011-6/+9
| | | | | | | | | | | CompilerInvocation on the stack, because other objects (e.g., the CompilerInstance) maintain an intrusive reference-counted pointer to the CompilerInvocation. This doesn't matter in the normal case, because we take back the CompilerInvocation. However, during crash recovery, this leads to us trying to free an object on the stack, and hilarity ensues. Fixes <rdar://problem/9652540>. llvm-svn: 134245
* Use existing -fcatch-undefined-behavior option,Fariborz Jahanian2011-06-291-3/+0
| | | | | | replacing -freset-local-blocks. // rdar://9227352 llvm-svn: 134082
* Under a compiler flag, -freset-local-blocks,Fariborz Jahanian2011-06-281-0/+3
| | | | | | | wipe out stack blocks when they go out of scope. // rdar://9227352 llvm-svn: 134045
* Fix PR9279 - Macro expansion stack trace seriously broken with ↵Chris Lattner2011-06-281-7/+9
| | | | | | | | | | | | | | function-style macros, by not recursively printing notes for other 'instantiated from' notes. This is a one line fix here: + // Don't print recursive instantiation notes from an instantiation note. + Loc = SM.getSpellingLoc(Loc); While here, fix the testcase to be more precise (it got filecheck'ized brutally), and fix EmitCaretDiagnostic to be private and to not pass down the unused 'Level' argument. llvm-svn: 133993
* Improve header search for MinGW(-w64), from Ruben Van Boxem!Douglas Gregor2011-06-271-27/+39
| | | | llvm-svn: 133911
* In TextDiagnosticPrinter::EmitCaretDiagnostic, don't always drop fixits if ↵Argyrios Kyrtzidis2011-06-241-2/+3
| | | | | | | | the caret location points to a macro instantiation. llvm-svn: 133802
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-13/+13
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* avoid using config.h in public headersDylan Noblesmith2011-06-231-0/+1
| | | | | | | | | | | This is the only usage in clang's headers, and it's for a define that only exists on CMake builds for the sake of the MSVC compiler, so just use an ifdef instead. Also add an include for config.h in a file that actually needs it, and was picking it up by accident indirectly. llvm-svn: 133710
* Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!Douglas Gregor2011-06-221-0/+44
| | | | llvm-svn: 133633
* Make InitHeaderSearch::AddPath and HeaderSearchOptions::AddPath consistentBob Wilson2011-06-212-7/+7
| | | | | | | | use an "IgnoreSysRoot" argument. HeaderSearchOptions had been using the opposite form with "IsSysRootRelative", which made for much confusion when looking at true/false values in calls in AddPath. No functional change. llvm-svn: 133550
* Fix the default libc++ header search path to be sysrooted. Radar 9639692.Bob Wilson2011-06-212-2/+10
| | | | | | | | | The -cxx-isystem path is not prefixed with the sysroot directory, so it's not a good way for the driver to set the system default C++ search path. Instead, add -stdlib as a cc1 option and teach the frontend how to find the headers. The driver can then just pass -stdlib through to "cc1". llvm-svn: 133547
* IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.Daniel Dunbar2011-06-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changes bit-field access policy to try to use (aligned) register sized accesses. The idea here is that by using larger accesses we expose more coalescing potential to the backend when we have situations like adjacent bit-fields in the same structure (which is common), and that the backend should be smart enough to narrow the accesses down when no coalescing is done or when it is shown not to be profitable. -- $ clang -m32 -O3 -S -o - t.c _f0: ## @f0 pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movb (%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, (%eax) movb 1(%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, 1(%eax) movb 2(%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, 2(%eax) movb 3(%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, 3(%eax) popl %ebp ret $ clang -m32 -O3 -S -o - t.c -Xclang -fuse-register-sized-bitfield-access _f0: ## @f0 pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl $-2139062144, %ecx ## imm = 0xFFFFFFFF80808080 andl (%eax), %ecx orl $16843009, %ecx ## imm = 0x1010101 movl %ecx, (%eax) popl %ebp ret -- llvm-svn: 133532
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-4/+3
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Add support for -Wa,--noexecstack when building from a non-assembly file. ForNick Lewycky2011-06-211-0/+3
| | | | | | | an assembly file it worked correctly, while for a .c file it would given an error about how --noexecstack is not a supported argument to -Wa. llvm-svn: 133489
* Define __cplusplus to 201103L when in (non-GNU) C++0x mode.Douglas Gregor2011-06-201-3/+10
| | | | llvm-svn: 133437
* [arcmt] Fix the ARC migrator. -arcmt-modify requires running before the ↵Argyrios Kyrtzidis2011-06-181-0/+8
| | | | | | | | initialization of SourceManager because it is going to modify the input file. llvm-svn: 133323
* [arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we ↵Argyrios Kyrtzidis2011-06-171-8/+1
| | | | | | hoped it would be. llvm-svn: 133315
* Fix a regression introduced by r131955 which broke #include_next in subtle ↵Chris Lattner2011-06-161-1/+4
| | | | | | | | | situations because the Angled directories and the System directories were not being uniqued together, breaking #include_next. I'll see about a testcase, but it will be insane. llvm-svn: 133212
* code cleanups, no behavior change.Chris Lattner2011-06-161-64/+64
| | | | llvm-svn: 133211
* Raise the ARCMT functionality in Clang into proper FrontendActions.Chandler Carruth2011-06-163-30/+38
| | | | | | | | | | | | | | | | | | | | | These are somewhat special in that they wrap any other FrontendAction, running various ARC transformations or checks prior to the standard action's run. To implement them easily, this extends FrontendAction to have a WrapperFrontendAction utility class which forwards all calls by default to an inner action setup at construction time. This is then subclassed to override the specific behavior needed by the different ARCMT tools. Finally, FrontendTool is taught how to create these wrapper actions from the existing flags and options structures. The result is that clangFrontend no longer depends on clangARCMigrate. This is very important, as clangARCMigrate *heavily* depends on clangFrontend. Fundamentally ARCMigrate is at the same layer as a library like Rewrite, sitting firmly on top of the Frontend, but tied together with the FrontendTool when building the clang binary itself. llvm-svn: 133161
* Be aware of (x86_64-redhat-linux6E-)g++44 on RHEL5.NAKAMURA Takumi2011-06-161-0/+3
| | | | | | | AFAIK, RHEL5 (and its clones) provides g++44 as the package "gcc44-c++". By default, g++-4.1.1 is available, though, its libstdc++ would not be suitable to clang++. llvm-svn: 133156
* Unconditionally #define the ARC ownership qualifiers, instead of #definingJohn McCall2011-06-161-0/+9
| | | | | | them only on Darwin tool chains. llvm-svn: 133112
* The ARC Migration Tool. All the credit goes to Argyrios and FariborzJohn McCall2011-06-153-0/+62
| | | | | | for this. llvm-svn: 133104
* Automatic Reference Counting.John McCall2011-06-152-12/+178
| | | | | | | | | | 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
* Introduce a -cc1-level option to turn off related result typeDouglas Gregor2011-06-141-0/+6
| | | | | | inference, to be used (only) by the Objective-C rewriter. llvm-svn: 133025
* Eliminate the -f[no]objc-infer-related-result-type flags; there's noDouglas Gregor2011-06-131-6/+0
| | | | | | reason to allow the user to control these semantics through a flag. llvm-svn: 132919
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* __OBJC__ is also a standard predefined macro.Nick Lewycky2011-06-101-1/+3
| | | | llvm-svn: 132855
* The macros defined by the language standard are still available even when theNick Lewycky2011-06-071-26/+37
| | | | | | | -undef flag is passed in. Also __ASSEMBLER__ with -x assembler-with-cpp. (Don't ask.) llvm-svn: 132708
* Fix cmake build.Rafael Espindola2011-06-041-1/+0
| | | | llvm-svn: 132653
* Remove the old implementation of -verify, which has been dead code since r88750.Richard Smith2011-06-041-301/+0
| | | | llvm-svn: 132651
* Don't warn about -Wno-foo where foo is an unknown warning option. ExplicitlyMatt Beaumont-Gay2011-06-031-1/+3
| | | | | | passing -Wunknown-warning-option will re-enable warnings about -Wno-foo. llvm-svn: 132570
* Separate out these paths a bit by architecture. There are likely otherEric Christopher2011-06-031-2/+3
| | | | | | places this is a problem. llvm-svn: 132542
* Add multi-arch include support for Ubuntu 11.11 with gcc 4.6.0.Eric Christopher2011-06-031-0/+23
| | | | | | | | Patch by Tobias Hunger! Fixes PR10008 llvm-svn: 132541
* Implement -fgnu89-inline. Fixes PR10041.Rafael Espindola2011-06-021-0/+3
| | | | llvm-svn: 132460
* Change the include stack of "instantiated from" notes to fall under the ↵Richard Trieu2011-05-261-1/+1
| | | | | | control of f/fno-diagnostics-show-note-include-stack flags. This should help with reducing diagnostic spew from macros instantiations. llvm-svn: 132143
* A StringRef-ication of the DiagnosticIDs API and internals.Argyrios Kyrtzidis2011-05-252-29/+24
| | | | | | | | | Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static diagnostic data structures, which resulted in a huge global-var-init function. Depends on llvm commit r132046. llvm-svn: 132047
OpenPOWER on IntegriCloud