summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Reapply "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-3018-195/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Recommitted in r224941 and reverted in r224970 after it caused a crash when building compiler-rt. Looks to be due to this change zeroing out the debug location when emitting default arguments (which were meant to inherit their outer expression's location) thus creating call instructions without locations - these create problems for inlining and must not be created. That is fixed and tested in this version of the change. Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 225000
* Driver: use the canonical library prefix on WindowsSaleem Abdulrasool2014-12-302-6/+7
| | | | | | | | Unlike Unices, Windows does not use a library prefix. Use the traditional naming scheme even for Windows itanium environments. This makes the builtins behave more like the sanitisers as well. llvm-svn: 224996
* Add non-const version getFileSystemOpts() access function.Yaron Keren2014-12-301-0/+3
| | | | | | All the other get*Opts have both versions. llvm-svn: 224995
* Add a public accessor for GlobalCtors in CodeGenModuleKeno Fischer2014-12-301-0/+5
| | | | | | | | | | | | | Summary: In a JIT context it is useful to be able to access the GlobalCtors and especially clear them once they have been emitted and called. This adds a public method to be able to access the list. Subscribers: yaron.keren, cfe-commits Differential Revision: http://reviews.llvm.org/D6790 llvm-svn: 224982
* Driver: unify addClangRT{Linux,Windows}Saleem Abdulrasool2014-12-301-20/+16
| | | | | | | | The differences are pretty superficial: - .lib vs .a extensions - whether or not to link (potentially) incorrectly against libgcc_s llvm-svn: 224975
* Don't crash on an invalid trailing return type on a function before a '...'Nico Weber2014-12-302-5/+9
| | | | | | | | | | | | clang tries to produce a helpful diagnostic for the traiilng '...', but the code that r216778 added for this doesn't expect an invalid trailing return type. Add code to explicitly handle this. Having explicit code for this but not for other things looks a bit strange, but trailing return types are special in that they have a separate existence bit in addition to the type (see r158348). llvm-svn: 224974
* Revert "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-2918-110/+195
| | | | | | | | | Asserting when building compiler-rt when using a GCC host compiler. Reverting while I investigate. This reverts commit r224941. llvm-svn: 224970
* Fix build breakageDavid Majnemer2014-12-291-1/+2
| | | | | | That's what I get for last second changes... llvm-svn: 224967
* Parse: Recover more gracefully from extra :: tokens before a {David Majnemer2014-12-292-1/+13
| | | | | | | Instead of crashing, recover by eating the extra trailing scope qualifier. This means we will treat 'struct A:: {' as 'struct A {'. llvm-svn: 224966
* PR22051: Missing debug location on calls in dtor thunks in Windows.David Blaikie2014-12-292-1/+23
| | | | llvm-svn: 224963
* Use std::find_if instead of manual loop.David Blaikie2014-12-291-8/+4
| | | | llvm-svn: 224960
* Crash even less on malformed attributes in an incorrect location.Nico Weber2014-12-292-5/+8
| | | | | | | | | | | This is a follow-up to r224915. This adds a bit more line noise to the tests added in that revision to make sure the parser is ready for a toplevel decl after each incorrect line. Use this to move the tests up to where they belong. This uncovered that the early return was missing a call to ActOnTagDefinitionError(), so add that. (Also fixes at least one of the crashes on SLi's bot.) llvm-svn: 224958
* Fix use-after-destruction introduced in r224924.Alexey Samsonov2014-12-291-1/+2
| | | | | | | | getMainExecutable() returns a std::string, assigning its result to StringRef immediately creates a dangling pointer. This was detected by half-broken fast-MSan-bootstrap bot. llvm-svn: 224956
* Driver: convert a couple more instances to range based loopsSaleem Abdulrasool2014-12-291-6/+4
| | | | | | | More conversion to range based for loops rather than direct iterators with dereferencing. NFC. llvm-svn: 224954
* Parse: Ignore '::' in 'struct :: {'David Majnemer2014-12-293-13/+16
| | | | | | | Let's pretend that we didn't see the '::' instead of go on believing that we've got some anonymous, but globally qualified, struct. llvm-svn: 224945
* Driver: convert a number of loops to range basedSaleem Abdulrasool2014-12-291-33/+10
| | | | | | | Iterate over the arguments via range based for loops rather than iterators and explicitly dereferencing them. NFC. llvm-svn: 224944
* Add an assertion to verify a container is non-empty before calling 'back()'David Blaikie2014-12-291-0/+1
| | | | | | | This would've helped stabilize/deflake some failures that were seen after some recent changes. llvm-svn: 224943
* Reapply "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-2918-195/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 224941
* Effectively revert r151058 which caused Clang's unwind.h to defer toChandler Carruth2014-12-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | libunwind in all cases when installed. At the time, Clang's unwind.h didn't provide huge chunks of the LSB-specified unwind interface, and was generally too aenemic to use for real software. However, it has since then become a strict superset of the APIs provided by libunwind on Linux. Notably, you cannot compile llgo's libgo library against libunwind, but you can against Clang's unwind.h. So let's just use our header. =] I've checked pretty thoroughly for any incompatibilities, and I am not aware of any. An open question is whether or not we should continue to munge GNU_SOURCE here. I didn't touch that as it potentially has compatibility implications on systems I cannot easily test -- Darwin. If a Darwin maintainer can verify that this is in fact unnecessary and remove it, cool. Until then, leaving it in makes this change a no-op there, and only really relevant on Linux systems where it is pretty clearly the right way to go. llvm-svn: 224934
* Add a missing declaration to our unwind.h implementation. This isChandler Carruth2014-12-291-0/+2
| | | | | | | | | necessary to be fully compatible with existing software that calls into the linux unwind code. You can find documentation of this API and why it exists in the discussion abot NPTL here: https://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html llvm-svn: 224933
* [multilib] Teach Clang's code about multilib by threadingChandler Carruth2014-12-296-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a CLANG_LIBDIR_SUFFIX down from the build system and using that as part of the default resource dir computation. Without this, essentially nothing that uses the clang driver works when building clang with a libdir suffix. This is probably the single biggest missing piece of support for multilib as without this people could hack clang to end up installed in the correct location, but it would then fail to find its own basic resources. I know of at least one distro that has some variation on this patch to hack around this; hopefully they'll be able to use the libdir suffix functionality directly as the rest of these bits land. This required fixing a copy of the code to compute Clang's resource directory that is buried inside of the frontend (!!!). It had bitrotted significantly relative to the driver code. I've made it essentially a clone of the driver code in order to keep tests (which use cc1 heavily) passing. This copy should probably just be removed and the frontend taught to always rely on an explicit resource directory from the driver, but that is a much more invasive change for another day. I've also updated one test which actually encoded the resource directory in its checked output to tolerate multilib suffixes. Note that this relies on a prior LLVM commit to add a stub to the autoconf build system for this variable. llvm-svn: 224924
* [cmake] Teach the Clang CMake build to use LLVM_LIBDIR_SUFFIX for itsChandler Carruth2014-12-291-3/+3
| | | | | | | | | | | | 'lib' directories in the build. This variable is available now both as part of the normal LLVM build an as part of a standalone build as I've added it to the LLVMConfig.cmake output. With this change we should at least put libraries into the multilib directory correctly. It is the first step in getting Clang to be reasonably multilib aware. llvm-svn: 224923
* Sema: Permit array l-values in asm output operandsDavid Majnemer2014-12-292-0/+7
| | | | | | | | GCC permits array l-values in asm output operands even though they aren't modifiable l-values. We used to permit it but this behavior regressed in r224916. llvm-svn: 224918
* Sema: Only permit permit modifiable l-values as asm output paramsDavid Majnemer2014-12-292-14/+52
| | | | | | | | | | Functions are l-values in C++ but shouldn't be available as output parameters in inline assembly. Neither should overloaded function l-values. This fixes PR21949. llvm-svn: 224916
* Don't crash on malformed attributes in an incorrect location.Nico Weber2014-12-292-0/+14
| | | | | | | | | | | | | | | | | | r168626 added nicer diagnostics for attributes in the wrong places, such as after the `final` on a class. To do this, it added code that did high-level pattern matching for e.g. 'final' 'alignas' '(' and then skipped until the closing ')'. If it saw that, it then went down the regular class parsing path and then called MaybeParseCXX11Attributes() to parse the attribute after the 'final' using real attribute parsing code. On invalid attributes, the real attribute parsing code could eat more tokens than the pattern matching code and for example skip past the '{' starting the class, which would then lead to an assert. To prevent this, check for a good state after calling MaybeParseCXX11Attributes() (which morphed into CheckMisplacedCXX11Attribute() in r175575) and bail out if things look bleak. Found by SLi's afl bot. llvm-svn: 224915
* [x86] Fix an accidental commit of a change from Ii to iC on ↵Craig Topper2014-12-291-1/+1
| | | | | | __builtin_ia32_cmpps512_mask. llvm-svn: 224914
* [x86] Put 'C' after 'i' on all the AVX-512 intrisics that take const ints. ↵Craig Topper2014-12-291-55/+55
| | | | | | 'C' is a suffix modifier not a prefix modififier. Also put 'C' on the pointers in all of the gather instrinsics. I think they previously had one due to the misordering. I'm still thinking the 'iC' actually need to be a 'Ii' since they really require an ICE. llvm-svn: 224913
* Sema: Don't crash when solitary :: token appears before { in struct defDavid Majnemer2014-12-293-6/+11
| | | | | | | | hasDeclaratorForAnonDecl, getDeclaratorForAnonDecl and getTypedefNameForAnonDecl are expected to handle the case where NamedDeclOrQualifier holds the wrong type or nothing at all. llvm-svn: 224912
* Sema: Forbid inconsistent constraint alternativesDavid Majnemer2014-12-293-0/+29
| | | | | | Verify that asm constraints have the same number of alternatives llvm-svn: 224911
* SemaCXX: Don't crash when annotation tokens show up before the tag nameDavid Majnemer2014-12-292-5/+13
| | | | | | | | Clang has a hack to accept definitions of structs with tag names which have the same name as intrinsics. However, this hack didn't guard against annotation tokens showing up in the token stream. llvm-svn: 224909
* CodeGen: Optimize emssion of zeroinitialzied arraysDavid Majnemer2014-12-281-12/+24
| | | | | | | | | Create an ConstantAggregateZero upfront if we see that it is viable. This saves us from having to manually push_back each and every initializer and then looping back over them to determine if they are 'null'. llvm-svn: 224908
* Don't crash on surprising tokens in default parameter template lists.Nico Weber2014-12-283-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | Fixes this snippet from SLi's afl fuzzer output: class { i (x = <, enum This parsed i as a function, x as a paramter, and the stuff after < as a template list. This then called TryConsumeDeclarationSpecifier() which called TryAnnotateCXXScopeToken() without checking the preconditions of this function. Check them before calling, like all other callers of TryAnnotateCXXScopeToken() do. A more readable reproducer that causes the same crash is class { void i(int x = MyTemplateClass<int, union int>::foo()); }; The reduced version used an eof token as surprising token, but kw_int works just as well to repro and is easier to insert into a test file. llvm-svn: 224906
* Sema: Variable templates cannot be static bitfield membersDavid Majnemer2014-12-282-1/+7
| | | | | | | We correctly forbid variables but not variable templates. Diagnose this case instead of crashing. llvm-svn: 224905
* Parse: Don't crash when 'typename' shows up in an attributeDavid Majnemer2014-12-283-2/+5
| | | | | | | | | isDeclarationSpecifier performs error recovers which jostles the token stream. Specifically, TryAnnotateTypeOrScopeToken will end up consuming a typename token which will confuse the attribute parsing machinery as we no-longer have something identifier-like. llvm-svn: 224903
* Sema: Permit an atomic type to be initialized by the same atomic typeDavid Majnemer2014-12-282-1/+9
| | | | | | | | | We forgot a conversion step when initializing an atomic type with an rvalue of the same type. This fixes PR22043. llvm-svn: 224902
* Sema: Don't crash when an inject class name has a nested redefinitionDavid Majnemer2014-12-284-7/+20
| | | | | | | | | We expected the type of a TagDecl to be a TagType, not an InjectedClassNameType. Introduced a helper method, Type::getAsTagDecl, to abstract away the difference; redefine Type::getAsCXXRecordDecl to be in terms of it. llvm-svn: 224898
* Lex: Don't let annotation tokens get into macro expansionDavid Majnemer2014-12-283-2/+8
| | | | | | | | | | We'd let annotation tokens from '#pragma pack' and the like get inside a function-like macro. This would lead to terror and mayhem; stop the madness early. This fixes PR22037. llvm-svn: 224896
* Fix markup from r224894.Nico Weber2014-12-281-6/+6
| | | | llvm-svn: 224895
* Add stub sections about Parse, Sema, CodeGen to the internals manual.Nico Weber2014-12-281-0/+32
| | | | | | | | | | I'd be interested if the paragraph on Parse not knowing much about AST is something folks agree with. I think this used to be true after rjmccall removed the Action interface in r112244 and I believe it's still true, but I'm not sure. (For example, ParseOpenMP.cpp does include AST/StmtOpenMP.h. Other than that, Parse not using AST nodes much seems to be still true, though.) llvm-svn: 224894
* Remove unneeded include of DeclCXX.h from libParse.Nico Weber2014-12-281-1/+0
| | | | llvm-svn: 224893
* Objective-C: Serialize "more than one decl" state of ObjCMethodList.Nico Weber2014-12-276-15/+59
| | | | | | | | | | | | | | | | | This fixes PR21587, what r221933 fixed for regular programs is now also fixed for decls coming from PCH files. Use another bit from the count/bits uint16_t for storing the "more than one decl" bit. This reduces the number of bits for the count from 14 to 13. The selector with the most overloads in Cocoa.h has ~55 overloads, so 13 bits should still be plenty. Since this changes the meaning of a serialized bit pattern, also increase clang::serialization::VERSION_MAJOR. Storing the "more than one decl" state of only the first overload isn't quite correct, but Sema::AreMultipleMethodsInGlobalPool() currently only looks at the state of the first overload so it's good enough for now. llvm-svn: 224892
* [x86] Also add the missing type casts on the returns in the shaChandler Carruth2014-12-271-6/+6
| | | | | | | intrinsic header file. Along with r224822, this should restore the build bots to passing. llvm-svn: 224883
* [x86] Add missing typecast to __v4si to sha intrinsic header file.Craig Topper2014-12-271-6/+6
| | | | llvm-svn: 224882
* Objective-C: Tweak unavailability warning.Nico Weber2014-12-272-5/+18
| | | | | | | Don't warn when a selector has an unavailable and an available variant, and the first also has an implementation. llvm-svn: 224881
* [x86] Add range checking to the constant argument of cmpps/pd/ss/sd builtinas.Craig Topper2014-12-272-4/+28
| | | | llvm-svn: 224880
* [x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse ↵Craig Topper2014-12-275-50/+518
| | | | | | | | | | intrinsic files. This still lower to the same intrinsics as before. This is preparation for bounds checking the immediate on the avx version of the builtin so we don't pass illegal immediates into the backend. Since SSE uses a smaller size immediate its not possible to bounds check when using a shared builtin. Rather than creating a clang specific builtin for the different immediate, I decided (after consulting with Chandler) that it was better to match gcc. llvm-svn: 224879
* Add more feature flags to the x86 instrinsic test.Craig Topper2014-12-271-0/+27
| | | | llvm-svn: 224878
* Fix formatting. NFC.Craig Topper2014-12-271-2/+2
| | | | llvm-svn: 224877
* Address review feedback on r221933.Nico Weber2014-12-276-102/+125
| | | | | | | | | | | Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in the low bit of the ObjCMethodDecl pointer, using a PointerIntPair. Most of this patch is replacing ".Method" with ".getMethod()". No intended behavior change. llvm-svn: 224876
* Make the test from r224873 actually pass.Nico Weber2014-12-271-2/+4
| | | | | | | The behavior looks incorrect to me, but the test is supposed to document current behavior for now. llvm-svn: 224875
OpenPOWER on IntegriCloud