summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Delete the driver's HostInfo class. This abstraction just never reallyChandler Carruth2012-01-254-725/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | did anything. The two big pieces of functionality it tried to provide was to cache the ToolChain objects for each target, and to figure out the exact target based on the flag set coming in to an invocation. However, it had a lot of flaws even with those goals: - Neither of these have anything to do with the host, or its info. - The HostInfo class was setup as a full blown class *hierarchy* with a separate implementation for each "host" OS. This required dispatching just to create the objects in the first place. - The hierarchy claimed to represent the host, when in fact it was based on the target OS. - Each leaf in the hierarchy was responsible for implementing the flag processing and caching, resulting in a *lot* of copy-paste code and quite a few bugs. - The caching was consistently done based on architecture alone, even though *any* aspect of the targeted triple might change the behavior of the configured toolchain. - Flag processing was already being done in the Driver proper, separating the flag handling even more than it already is. Instead of this, we can simply have the dispatch logic in the Driver which previously created a HostInfo object create the ToolChain objects. Adding caching in the Driver layer is a tiny amount of code. Finally, pulling the flag processing into the Driver puts it where it belongs and consolidates it in one location. The result is that two functions, and maybe 100 lines of new code replace over 10 classes and 800 lines of code. Woot. This also paves the way to introduce more detailed ToolChain objects for various OSes without threading through a new HostInfo type as well, and the accompanying boiler plate. That, of course, was the yak I started to shave that began this entire refactoring escapade. Wheee! llvm-svn: 148950
* Add support for const pointer to literal-objc string as format attribute.Jean-Daniel Dupas2012-01-251-0/+4
| | | | llvm-svn: 148948
* Switch the ToolChain types to all store a Driver reference rather thanChandler Carruth2012-01-255-64/+61
| | | | | | | | | | a HostInfo reference. Nothing about the HostInfo was used by any toolchain except digging out the driver from it. This just makes that a lot more direct. The change was accomplished entirely mechanically. It's one step closer to removing the shim full of buggy copy/paste code that is HostInfo. llvm-svn: 148945
* Fixup r148926, for -Asserts.NAKAMURA Takumi2012-01-251-1/+1
| | | | llvm-svn: 148943
* Remove the TargetTriple object that I added to the Driver recently. ThisChandler Carruth2012-01-251-12/+12
| | | | | | | | | | | | | | | helped stage the refactoring of things a bit, but really isn't the right place for it. The driver may be responsible for compilations with many different targets. In those cases, having a target triple in the driver is actively misleading because for many of those compilations that is not actually the triple being targeted. This moves the last remaining users of the Driver's target triple to instead use the ToolChain's target triple. The toolchain has a single, concrete target it operates over, making this a more stable and natural home for it. llvm-svn: 148942
* Have FreeBSD use even more of the same smarts as Linux is now using forChandler Carruth2012-01-251-6/+6
| | | | | | | | | | | | | | | adding search paths. Add them only when they exist, and prefix the paths with the sysroot. This will allow targeting a FreeBSD sysroot on a non-FreeBSD host machine, and perhaps more importantly should allow testing the FreeBSD driver's behavior similarly to the Linux tests with a fake tree of files in the regression test suite. I don't have FreeBSD systems handy to build up the list of files that should be used here, but this is the basic functionality and I'm hoping Roman or someone from the community can contribute the actual test cases. llvm-svn: 148940
* Switch FreeBSD to just include both '/usr/lib32' and '/usr/lib' in theChandler Carruth2012-01-251-16/+7
| | | | | | | | | search paths for 32-bit targets. This avoids having to detect which is expected for the target system, and the linker should DTRT, and take the 32-bit libraries from the first one when applicable. Thanks to Roman Divacky for sanity checking this. llvm-svn: 148939
* Switch the Linux C++ standard library header search logic over to useChandler Carruth2012-01-251-15/+8
| | | | | | the GCC installation's multiarch suffix now that it is exposed. llvm-svn: 148938
* Make a major refactoring to how the GCC installation detection works.Chandler Carruth2012-01-252-132/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fundamental shift here is to stop making *any* assumptions about the *host* triple. Where these assumptions you ask? Why, they were in one of the two target triples referenced of course. This was the single biggest place where the previously named "host triple" was actually used as such. ;] The reason we were reasoning about the host is in order to detect the use of '-m32' or '-m64' flags to change the target. These flags shift the default target only slightly, which typically means a slight deviation from the host. When using these flags, the GCC installation is under a different triple from the one actually targeted in the compilation, and we used the host triple to find it. Too bad that wasn't even correct. Consider an x86 Linux host which has a PPC64 cross-compiling GCC toolchain installed. This toolchain is also configured for multiarch compiling and can target PPC32 with eth '-m32' flag. When targeting 'powerpc-linux-gnu' or some other PPC32 triple, we have to look for the PPC64 variant of the triple to find the GCC install, and that triple is neither the host nor target. The new logic computes the multiarch's alternate triple from the target triple, and looks under both sides. It also looks more aggressively for the correct subdirectory of the GCC installation, and exposes the subdirectory in a nice programmatic way. This '/32' or '/64' suffix is something we can reuse in many other parts of the toolchain. An important note -- while this likely fixes a large category of cross-compile use cases, that's not my primary goal, and I've not done testing (or added test cases) for scenarios that may now work. If someone else wants to try more interesting PPC cross compiles, I'd love to have reports. But my focus is on factoring away the references to the "host" triple. The refactoring is my goal, and so I'm mostly relying on the existing (pretty good) test coverage we have here. Future patches will leverage this new functionality to factor out more and more of the toolchain's triple manipulation. llvm-svn: 148935
* Fix -fmacro-backtrace-limit=0 to show the entire macro backtrace.Ted Kremenek2012-01-251-1/+2
| | | | llvm-svn: 148930
* reapply r148902:Chris Lattner2012-01-253-50/+24
| | | | | | | | | | "use the new ConstantVector::getSplat method where it makes sense." Also simplify a bunch of code to use the Builder->getInt32 instead of doing it the hard and ugly way. Much more progress could be made here, but I don't plan to do it. llvm-svn: 148926
* Fix a crash for an edge case of the GNU ?: extension.Eli Friedman2012-01-251-2/+2
| | | | llvm-svn: 148923
* Fix r148920 to what I actually meant to commit.Eli Friedman2012-01-251-1/+3
| | | | llvm-svn: 148921
* Add missing check for placeholders.Eli Friedman2012-01-251-4/+10
| | | | llvm-svn: 148920
* Represent 256-bit unaligned loads natively and remove the builtins. Similar ↵Craig Topper2012-01-251-3/+12
| | | | | | change was made for 128-bit versions a while back. llvm-svn: 148919
* In TreeTransform<Derived>::TransformBlockExpr, call ActOnBlockError for errors,Argyrios Kyrtzidis2012-01-251-2/+7
| | | | | | patch by Dmitri Gribenko. llvm-svn: 148915
* Revert 148902 which was part of 148901 which was reverted in r148906.Argyrios Kyrtzidis2012-01-253-24/+48
| | | | | | | Original log: use the new ConstantVector::getSplat method where it makes sense. llvm-svn: 148907
* Fix PR11848: decree that an alias template contains an unexpanded parameter packRichard Smith2012-01-252-3/+5
| | | | | | | | | | | | | iff its substitution contains an unexpanded parameter pack. This has the effect that we now reject declarations such as this (which we used to crash when expanding): template<typename T> using Int = int; template<typename ...Ts> void f(Int<Ts> ...ints); The standard is inconsistent on how this case should be treated. llvm-svn: 148905
* Refactor the record decl forward declaration code a bit.Eric Christopher2012-01-252-37/+31
| | | | llvm-svn: 148904
* Typo.Eric Christopher2012-01-251-1/+1
| | | | llvm-svn: 148903
* use the new ConstantVector::getSplat method where it makes sense.Chris Lattner2012-01-253-48/+24
| | | | llvm-svn: 148902
* With a little more work in the tentative parse determining whether a statementNick Lewycky2012-01-251-2/+25
| | | | | | | | is a declaration-stmt or an expression, we can discern a subset of cases where the user erred in omitting the typename keyword before a dependent type name. Fixes PR11358! llvm-svn: 148896
* Introduce a generation number for selector lookups in the globalDouglas Gregor2012-01-251-4/+16
| | | | | | | method pool, so that we don't perform the same lookups into the same PCH/module file repeatedly. llvm-svn: 148895
* Only try to import a definition if there is an definition to import.Douglas Gregor2012-01-251-2/+5
| | | | llvm-svn: 148894
* Make sure we correctly treat __is_convertible_to as an unevaluated context. ↵Eli Friedman2012-01-251-2/+3
| | | | | | PR11833. llvm-svn: 148893
* Whenever Sema attempts to look in the global method pool, try to loadDouglas Gregor2012-01-251-21/+11
| | | | | | | | | additional data from the external Sema source. This properly copes with modules that are imported after we have already searched in the global method pool for a given selector. For PCH, it's a slight pessimization to be fixed soon. llvm-svn: 148891
* Add "multiple format attributes" support on block.Jean-Daniel Dupas2012-01-251-6/+6
| | | | llvm-svn: 148890
* Rework the external Sema source's ReadMethodPool() so that it doesn'tDouglas Gregor2012-01-254-66/+55
| | | | | | | return pre-built lists. Instead, it feeds the methods it deserializes to Sema so that Sema can unique them, which keeps the chains shorter. llvm-svn: 148889
* Reduce peak memory usage of the static analyzer on sqlite3 (when using ↵Ted Kremenek2012-01-251-3/+23
| | | | | | | | | | | inlining) by 30%. This is accomplished by periodically reclaiming nodes in the graph. This was an optimization done before the CFG was linearized, but the CFG linearization destroyed that optimization since each freshly created node couldn't be reclaimed and we only looked at a window of nodes created between each ProcessStmt. This optimization can be reclaimed my merely expanding the window to N number of nodes. llvm-svn: 148888
* arc migrator: Provide infrastructure to add optionsFariborz Jahanian2012-01-255-4/+42
| | | | | | | | | specific to migrator. Use its first option to warn migrating from GC to arc when NSAllocateCollectable/NSReallocateCollectable is used. // rdar://10532541 llvm-svn: 148887
* Factor out the addition of a method into the global method pool, andDouglas Gregor2012-01-251-35/+48
| | | | | | | teach it to always add the new method at the *end* of the list rather than as the second element in the list. llvm-svn: 148886
* Fix NSLog format string checking for %@.Ted Kremenek2012-01-252-1/+4
| | | | llvm-svn: 148885
* Switch PerformImplicitConversion over to use DefaultLvalueConversion for ↵Eli Friedman2012-01-241-3/+5
| | | | | | lvalue-to-rvalue conversion. llvm-svn: 148874
* Replace a hack to handle NSLog/NSLogv in sema by declaring them as Library ↵Jean-Daniel Dupas2012-01-241-12/+9
| | | | | | Builtins. llvm-svn: 148873
* [libclang] In clang::getCursorKindForDecl() don't return "UnexposedDecl"Argyrios Kyrtzidis2012-01-241-13/+2
| | | | | | | | for forward references of classes and protocols, this breaks libclang API usage. rdar://10747438. llvm-svn: 148861
* Teach scanf/printf checking about '%Ld' and friends (a GNU extension). ↵Ted Kremenek2012-01-243-4/+18
| | | | | | Fixes PR 9466. llvm-svn: 148859
* Add a new warning, -Wover-aligned, which detects attempts to use the defaultNick Lewycky2012-01-241-0/+16
| | | | | | | allocator to construct an object which declares more alignment than the default allocator actually provides. Fixes PR9527! llvm-svn: 148857
* Fix one of the (larger) FIXMEs where we were misusing the Driver's ideaChandler Carruth2012-01-241-19/+23
| | | | | | | | | | | | | | | | | | | | | of the target triple to stand in for the "host" triple. Thanks to a great conversation with Richard Smith, I'm now much more confident in how this is proceeding. In all of the places where we currently reason about the "host" architecture or triple, what we really want to reason about in the detected GCC installation architecture or triple, and the ways in which that differs from the target. When we find a GCC installation with a different triple from our target *but capable of targeting our target* through an option such as '-m64', we want to detect *that* case and change the paths within the GCC installation (and libstdc++ installation) to reflect this difference. This patch makes one function do this correctly. Subsequent commits will hoist the logic used here into the GCCInstallation utility, and then reuse it through the rest of the toolchains to fix the remaining places where this is currently happening. llvm-svn: 148852
* Small code cleanup/simplification in Sema::ClassifyName.Kaelyn Uhrain2012-01-241-7/+7
| | | | llvm-svn: 148850
* objc: Issue a generic diagnostic assigning to Fariborz Jahanian2012-01-241-6/+1
| | | | | | an objc object in any abi mode. llvm-svn: 148847
* [analyzer] Add more C taint sources/sinks.Anna Zaks2012-01-241-22/+45
| | | | llvm-svn: 148844
* Address one part of the FIXME I introduced my switching the tripleChandler Carruth2012-01-242-15/+14
| | | | | | | | | | inside of GCCInstallation to be a proper llvm::Triple. This is still a touch ugly because we have to use it as a string in so many places, but I think on the whole the more structured representation is better. Comments of course welcome if this tradeoff isn't working for folks. llvm-svn: 148843
* The following patch adds __attribute__((no_address_safety_analysis)) which ↵Kostya Serebryany2012-01-243-0/+29
| | | | | | | | | | | | | | | will allow to disable address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function. When building with AddressSanitizer, add AddressSafety function attribute to every generated function except for those that have __attribute__((no_address_safety_analysis)). With this patch we will be able to 1. disable AddressSanitizer for a particular function 2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on. llvm-svn: 148842
* At least within these classes, consistently spell 'GCC' as 'GCC'.Chandler Carruth2012-01-242-24/+24
| | | | | | | | I can't read Java-style 'Gcc' acronyms. ;] No functionality changed. llvm-svn: 148840
* Start hoisting the logic for computing the target triple into its ownChandler Carruth2012-01-242-18/+28
| | | | | | | | | | | | | | | | | | | | | | function. The logic for this, and I want to emphasize that this is the logic for computing the *target* triple, is currently scattered throughout various different HostInfo classes ToolChain factoring functions. Best part, it is largely *duplicated* there. The goal is to hoist all of that up to here where we can deal with it once, and in a consistent manner. Unfortunately, this uncovers more fun problems: the ToolChains assume that the *actual* target triple is the one passed into them by these factory functions, while the *host* triple is the one in the driver. This already was a lie, and a damn lie, when the '-target' flag was specified. It only really worked when the difference stemmed from '-m32' and '-m64' flags. I'll have to fix that (and remove all the FIXMEs I've introduced here to document the problem) before I can finish hoisting the target-calculation logic. It's bugs all the way down today it seems... llvm-svn: 148839
* Promote the extension warning for attempts to catch a reference orDouglas Gregor2012-01-241-10/+3
| | | | | | | | | | pointer to incomplete type from an ExtWarn to an error. We put the ExtWarn in place as part of a workaround for Boost (PR6527), but it (1) doesn't actually match a GCC extension and (2) has been fixed for two years in Boost, and (3) causes us to emit code that fails badly at run time, so it's a bad idea to keep it. Fixes PR11803. llvm-svn: 148838
* When importing a RecordDecl as a DeclContext, make sure that we pullDouglas Gregor2012-01-241-8/+38
| | | | | | in the definition as well. llvm-svn: 148831
* objc: issue error if assigning objects in fragile-abi too.Fariborz Jahanian2012-01-241-4/+8
| | | | | | // rdar://10731065 llvm-svn: 148823
* Teach the AST importer about redeclaration chains for Objective-CDouglas Gregor2012-01-241-152/+197
| | | | | | classes and protocols, implementing lazy-import semantics for both. llvm-svn: 148816
* Only mark an IdentifierInfo as having changed since deserializationDouglas Gregor2012-01-244-13/+20
| | | | | | | | when it actually has changed (and not, e.g., when we've simply attached a deserialized macro definition). Good for ~1.5% reduction in module file size, mostly in the identifier table. llvm-svn: 148808
OpenPOWER on IntegriCloud