summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [ARM] Implement ISB memory barrier intrinsicYi Kong2014-07-031-0/+6
| | | | | | | Adds support for __builtin_arm_isb. Also corrects DSB and ISB instructions modelling by adding has-side-effects property. llvm-svn: 212277
* ARM: add support for v8 ldaex/stlex builtins.Tim Northover2014-07-022-0/+100
| | | | | | | | | | | | | | ARMv8 adds (to both AArch32 and AArch64) acquiring and releasing variants of the exclusive operations, in line with the C++11 memory model. This adds support for two new intrinsics to expose them to C & C++ developers directly: __builtin_arm_ldaex and __builtin_arm_stlex, in direct analogy with the versions with no implicit barrier. rdar://problem/15885451 llvm-svn: 212175
* Make FunctionDecl::getReturnTypeSourceRange() support non-builtin typesAlp Toker2014-07-021-4/+6
| | | | | | | Also document that the function is a "best-effort" facility to extract source ranges from limited AST type location info. llvm-svn: 212174
* Don't accept qualified 'int' main return types in C++ or standard C modeAlp Toker2014-07-021-0/+2
| | | | | | | | | C++ [basic.start.main]p1: "It shall have a return type of type int" ISO C is also clear about this, so only accept 'int' with qualifiers in GNUMode C. llvm-svn: 212171
* Get arm_acle tests from r211962 workingAlp Toker2014-06-281-1/+1
| | | | llvm-svn: 211979
* Introduce arm_acle.h supporting existing LLVM builtin intrinsicsYi Kong2014-06-271-0/+16
| | | | | | | | | | | | | | Summary: This patch introduces ACLE header file, implementing extensions that can be directly mapped to existing Clang intrinsics. It implements for both AArch32 and AArch64. Reviewers: t.p.northover, compnerd, rengolin Reviewed By: compnerd, rengolin Subscribers: rnk, echristo, compnerd, aemerson, mroth, cfe-commits Differential Revision: http://reviews.llvm.org/D4296 llvm-svn: 211962
* Fix treatment of types defined in function prototypeSerge Pavlov2014-06-251-0/+4
| | | | | | | | | | | | Types defined in function prototype are diagnosed earlier in C++ compilation. They are put into declaration context where the prototype is introduced. Later on, when FunctionDecl object is created, these types are moved into the function context. This patch fixes PR19018 and PR18963. Differential Revision: http://reviews.llvm.org/D4145 llvm-svn: 211718
* AST: Initialization with dllimport functions in CDavid Majnemer2014-06-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C++ language requires that the address of a function be the same across all translation units. To make __declspec(dllimport) useful, this means that a dllimported function must also obey this rule. MSVC implements this by dynamically querying the import address table located in the linked executable. This means that the address of such a function in C++ is not constant (which violates other rules). However, the C language has no notion of ODR nor does it permit dynamic initialization whatsoever. This requires implementations to _not_ dynamically query the import address table and instead utilize a wrapper function that will be synthesized by the linker which will eventually query the import address table. The effect this has is, to say the least, perplexing. Consider the following C program: __declspec(dllimport) void f(void); typedef void (*fp)(void); static const fp var = &f; const fp fun() { return &f; } int main() { return fun() == var; } MSVC will statically initialize "var" with the address of the wrapper function and "fun" returns the address of the actual imported function. This means that "main" will return false! Note that LLVM's optimizers are strong enough to figure out that "main" should return true. However, this result is dependent on having optimizations enabled! N.B. This change also permits the usage of dllimport declarators inside of template arguments; they are sufficiently constant for such a purpose. Add tests to make sure we don't regress here. llvm-svn: 211677
* The ability to use vector initializer lists is a GNU vector extensionJames Molloy2014-06-201-0/+13
| | | | | | | | | | | | | | | | | | | | | | and is unrelated to the NEON intrinsics in arm_neon.h. On little endian machines it works fine, however on big endian machines it exhibits surprising behaviour: uint32x2_t x = {42, 64}; return vget_lane_u32(x, 0); // Will return 64. Because of this, explicitly call out that it is unsupported on big endian machines. This patch will emit the following warning in big-endian mode: test.c:3:15: warning: vector initializers are a GNU extension and are not compatible with NEON intrinsics [-Wgnu] int32x4_t x = {0, 1, 2, 3}; ^ test.c:3:15: note: consider using vld1q_s32() to initialize a vector from memory, or vcombine_s32(vcreate_s32(), vcreate_s32()) to initialize from integer constants 1 warning generated. llvm-svn: 211362
* Sema: Static redeclaration after extern declarations is a Microsoft ExtensionDavid Majnemer2014-06-184-8/+8
| | | | | | | | | | | CL permits static redeclarations to follow extern declarations. The storage specifier on the latter declaration has no effect. This fixes PR20034. Differential Revision: http://reviews.llvm.org/D4149 llvm-svn: 211238
* Rewrite ARM NEON intrinsic emission completely.James Molloy2014-06-172-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There comes a time in the life of any amateur code generator when dumb string concatenation just won't cut it any more. For NeonEmitter.cpp, that time has come. There were a bunch of magic type codes which meant different things depending on the context. There were a bunch of special cases that really had no reason to be there but the whole thing was so creaky that removing them would cause something weird to fall over. There was a 1000 line switch statement for code generation involving string concatenation, which actually did lexical scoping to an extent (!!) with a bunch of semi-repeated cases. I tried to refactor this three times in three different ways without success. The only way forward was to rewrite the entire thing. Luckily the testing coverage on this stuff is absolutely massive, both with regression tests and the "emperor" random test case generator. The main change is that previously, in arm_neon.td a bunch of "Operation"s were defined with special names. NeonEmitter.cpp knew about these Operations and would emit code based on a huge switch. Actually this doesn't make much sense - the type information was held as strings, so type checking was impossible. Also TableGen's DAG type actually suits this sort of code generation very well (surprising that...) So now every operation is defined in terms of TableGen DAGs. There are a bunch of operators to use, including "op" (a generic unary or binary operator), "call" (to call other intrinsics) and "shuffle" (take a guess...). One of the main advantages of this apart from making it more obvious what is going on, is that we have proper type inference. This has two obvious advantages: 1) TableGen can error on bad intrinsic definitions easier, instead of just generating wrong code. 2) Calls to other intrinsics are typechecked too. So we no longer need to work out whether the thing we call needs to be the Q-lane version or the D-lane version - TableGen knows that itself! Here's an example: before: case OpAbdl: { std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)"; if (typestr[0] != 'U') { // vabd results are always unsigned and must be zero-extended. std::string utype = "U" + typestr.str(); s += "(" + TypeString(proto[0], typestr) + ")"; abd = "(" + TypeString('d', utype) + ")" + abd; s += Extend(utype, abd) + ";"; } else { s += Extend(typestr, abd) + ";"; } break; } after: def OP_ABDL : Op<(cast "R", (call "vmovl", (cast $p0, "U", (call "vabd", $p0, $p1))))>; As an example of what happens if you do something wrong now, here's what happens if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U", $p0): arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)' Available overloads: - float64x2_t vabdq_v(float64x2_t, float64x2_t) - float64x1_t vabd_v(float64x1_t, float64x1_t) - float64_t vabdd_f64(float64_t, float64_t) - float32_t vabds_f32(float32_t, float32_t) ... snip ... This makes it seriously easy to work out what you've done wrong in fairly nasty intrinsics. As part of this I've massively beefed up the documentation in arm_neon.td too. Things still to do / on the radar: - Testcase generation. This was implemented in the previous version and not in the new one, because - Autogenerated tests are not being run. The testcase in test/ differs from the autogenerated version. - There were a whole slew of special cases in the testcase generation that just felt (and looked) like hacks. If someone really feels strongly about this, I can try and reimplement it too. - Big endian. That's coming soon and should be a very small diff on top of this one. llvm-svn: 211101
* Teach __alignof__ to look through arrays before performing theRichard Smith2014-06-101-0/+4
| | | | | | | preferred-alignment transformations. Corrects alignof(T[]) to return alignof(T) in all cases, as required by relevant standards. llvm-svn: 210609
* Add pointer types to global named registerRenato Golin2014-06-051-0/+10
| | | | | | | | | | This patch adds support for pointer types in global named registers variables. It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls. Also adds some early checks on types on SemaDecl to avoid the assert. Tests changed accordingly. (PR19837) llvm-svn: 210274
* Add __builtin_operator_new and __builtin_operator_delete, which act like callsRichard Smith2014-06-031-0/+5
| | | | | | | to the normal non-placement ::operator new and ::operator delete, but allow optimizations like new-expressions and delete-expressions do. llvm-svn: 210137
* Update for llvm API change.Rafael Espindola2014-06-032-16/+7
| | | | | | Aliases in llvm now hold an arbitrary expression. llvm-svn: 210063
* Format strings: check against an enum's underlying type.Jordan Rose2014-05-312-11/+11
| | | | | | | | | | | | | This allows us to be more careful when dealing with enums whose fixed underlying type requires special handling in a format string, like NSInteger. A refinement of r163266 from a year and a half ago, which added the special handling for NSInteger and friends in the first place. <rdar://problem/16616623> llvm-svn: 209966
* AArch64/ARM64: update Clang after AArch64 removal.Tim Northover2014-05-241-1/+0
| | | | | | | | | | | A few (mostly CodeGen) parts of Clang were tightly coupled to the AArch64 backend. Now that it's gone, they will not even compile. I've also deduplicated RUN lines in many of the AArch64 tests. This might improve "make check-all" time noticably: some of those NEON tests were monsters. llvm-svn: 209578
* Sema: Add more tests for dll attributes on inline functionsNico Rieck2014-05-232-1/+7
| | | | llvm-svn: 209542
* Improved location for non-constant initializers diagnostics.Abramo Bagnara2014-05-221-1/+6
| | | | llvm-svn: 209466
* An inline function redeclaration does not drop the dllimport attributeHans Wennborg2014-05-221-0/+4
| | | | llvm-svn: 209449
* Improved recovery of switch statementSerge Pavlov2014-05-211-1/+1
| | | | | | | | | Make better diagnostic produced by erroneous switch statement. It fixes PR19022. Differential Revision: http://reviews.llvm.org/D3137 llvm-svn: 209302
* Add a check for tautological bitwise comparisons to -Wtautological-compare.Jordan Rose2014-05-201-0/+28
| | | | | | | | | | | This catches issues like: if ((x & 8) == 4) { ... } if ((x | 4) != 3) { ... } Patch by Anders Rönnholm! llvm-svn: 209221
* Non-allocatable Global Named RegisterRenato Golin2014-05-192-3/+0
| | | | | | | | | | | | | This patch implements global named registers in Clang, lowering to the just created intrinsics in LLVM (@llvm.read/write_register). A new type of LValue had to be created (Register), which just adds support to carry the metadata node containing the name of the register. Two new methods to emit loads and stores interoperate with another to emit the named metadata node. No guarantees are being made and only non-allocatable global variable named registers are being supported. Local named register support is unchanged. llvm-svn: 209149
* Update for llvm api change.Rafael Espindola2014-05-162-7/+16
| | | | | | | | | | Now that llvm cannot represent alias cycles, we have to diagnose erros just before trying to close the cycle. This degrades the errors a bit. The real solution is what it was before: if we want to provide good errors for these cases, we have to be able to find a clang level decl given a mangled name and produce the error from Sema. llvm-svn: 209008
* Allow dllimport/dllexport on inline functions and adjust the linkage.Hans Wennborg2014-05-152-5/+5
| | | | | | | | This is a step towards handling these attributes on classes (PR11170). Differential Revision: http://reviews.llvm.org/D3772 llvm-svn: 208925
* Create a redeclaration when an elaborated type specifierJohn McCall2014-05-141-0/+3
| | | | | | | | | resolves to an existing declaration if there are attributes present. This gives us something to apply the attributes to. llvm-svn: 208756
* Parameter/argument terminology fixesAlp Toker2014-05-111-0/+2
| | | | llvm-svn: 208499
* Fix pr19653.Rafael Espindola2014-05-051-0/+8
| | | | | | Warn if an alias requests a section other than the aliasee section. llvm-svn: 207997
* Fix some typosAlp Toker2014-05-051-2/+2
| | | | llvm-svn: 207994
* Bitrig now supports TLS, so enable TLS support when targeting it. Patch by ↵Richard Smith2014-05-011-0/+4
| | | | | | Patrick Wildt! llvm-svn: 207812
* __thread: Move constant init check to CheckCompleteVariableDeclarationReid Kleckner2014-04-301-0/+13
| | | | | | | | | | We were emitting dynamic initializers for __thread variables if there was no explicit initializer, as in this test case: struct S { S(); }; __thread S s; llvm-svn: 207675
* Add a test for big-endian NEON on ARM64.James Molloy2014-04-301-0/+1
| | | | | | | The enabled test #includes <arm_neon.h>, which is sufficient to test all the code in r207624. llvm-svn: 207641
* Let stddef.h respect __need_{wchar_t, size_t, NULL, ptrdiff_t, wint_t}.Nico Weber2014-04-301-1/+2
| | | | | | | | | | | | | | | | glibc expects that stddef.h only defines a single thing if either of these defines is set. For example, before this change, a C file containing #include <stdlib.h> int ptrdiff_t = 0; would compile with gcc but not with clang. Now it compiles with clang too. This also fixes PR12997, where older versions of the Linux headers would define NULL incorrectly, and glibc would define __need_NULL and expect stddef.h to redefine NULL with the correct definition. llvm-svn: 207606
* scanf analysis: handle scanlists that start with ^] (PR19559)Hans Wennborg2014-04-291-0/+5
| | | | llvm-svn: 207573
* LLVM supports TLS on Windows and we can use it from ClangReid Kleckner2014-04-291-3/+2
| | | | | | | | Patch by Martell Malone! Differential Revision: http://reviews.llvm.org/D3421 llvm-svn: 207470
* Make test pass on 32 bit architectures.Benjamin Kramer2014-04-251-1/+1
| | | | llvm-svn: 207268
* Print detailed vector type information on diagnostics.Benjamin Kramer2014-04-257-47/+47
| | | | | | | | | | | | | | | | | | | | | | We never aka vector types because our attributed syntax for it is less comprehensible than the typedefs. This leaves the user in the dark when the typedef isn't named that well. Example: v2s v; v4f w; w = v; The naming in this cases isn't even that bad, but the error we give is useless without looking up the actual typedefs. t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s' Now: t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from incompatible type 'v2s' (vector of 2 'int' values) We do this for all diagnostics that print a vector type. llvm-svn: 207267
* [ARM64] Change inline assembly constraints to be more lax, to match the ↵James Molloy2014-04-232-2/+4
| | | | | | | | behaviour of Clang/AArch64 and GCC. GCC allows sub-64bit values to use the 'r' register constraint. llvm-svn: 206963
* Comment parsing: in the generated XML file, mark HTML that is safe to passDmitri Gribenko2014-04-221-0/+13
| | | | | | | | | | | through to the output even if the input comment comes from an untrusted source Attribute filtering is currently based on a blacklist, which right now includes all event handler attributes (they contain JavaScipt code). It should be switched to a whitelist, but going over all of the HTML5 spec requires a significant amount of time. llvm-svn: 206882
* [ARM64] Fix __clear_cache - ensure it is predefined.James Molloy2014-04-171-0/+1
| | | | llvm-svn: 206465
* [ARM64] Add ARM64 RUN lines to a bunch of tests that had AARCH64 RUN lines.James Molloy2014-04-173-0/+5
| | | | | | | This covers all tests in tests/Driver and tests/Preprocessor, but there are some failing tests in test/Sema that need looking into. llvm-svn: 206464
* [ARM64] Allow the disabling of NEON and crypto instructions. Update tests to ↵James Molloy2014-04-161-1/+1
| | | | | | pass -target-feature +neon. llvm-svn: 206394
* Re-enable several builtins in non-gnu modes.Evgeniy Stepanov2014-04-161-8/+0
| | | | | | | | | This is a partial revert of 183015. By not recognizing things like _setjmp we lose (returns_twice) attribute on them, which leads to incorrect code generation. Fixes PR16138. llvm-svn: 206362
* AST: Respect alignment attributes on typedef'd arraysJustin Bogner2014-04-151-0/+11
| | | | | | | | | When instantiating an array that has an alignment attribute on it, we were looking through the array type and only considering the element type for the resulting alignment. We need to make sure we take the array's requirements into account too. llvm-svn: 206317
* Fix a bad interaction between -Wtautological-overlap-compare and delayedRichard Trieu2014-04-151-0/+6
| | | | | | diagnostics which caused delayed diagnostics on dead paths to be emitted. llvm-svn: 206232
* MS ABI: Bitfields FielDecls only align if they allocateDavid Majnemer2014-04-131-2/+24
| | | | | | | | | Don't consider a __declspec(align) on a bitfield's declaration if it didn't allocate any underlying storage. This fixes PR19414. llvm-svn: 206132
* Add a -triple argument so that this new test passes on Darwin.Bob Wilson2014-04-091-1/+1
| | | | | | The section names used here are not valid for Mach-O. llvm-svn: 205920
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-081-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the msvc pragmas section, bss_seg, code_seg, const_seg and data_seg as well as support for __declspec(allocate()). Additionally it corrects semantics and adds diagnostics for __attribute__((section())) and the interaction between the attribute and the msvc pragmas and declspec. In general conflicts should now be well diganosed within and among these features. In supporting the pragmas new machinery for uniform lexing for msvc pragmas was introduced. The new machinery always lexes the entire pragma and stores it on an annotation token. The parser is responsible for parsing the pragma when the handling the annotation token. There is a known outstanding bug in this implementation in C mode. Because these attributes and pragmas apply _only_ to definitions, we process them at the time we detect a definition. Due to tentative definitions in C, we end up processing the definition late. This means that in C mode, everything that ends up in a BSS section will end up in the _last_ BSS section rather than the one that was live at the time of tentative definition, even if that turns out to be the point of actual definition. This issue is not known to impact anything as of yet because we are not aware of a clear use or use case for #pragma bss_seg but should be fixed at some point. Differential Revision=http://reviews.llvm.org/D3065#inline-16241 llvm-svn: 205810
* Revert r205646 (keeping the test in its modified form) asFariborz Jahanian2014-04-071-2/+2
| | | | | | it is subsumed by r205521. llvm-svn: 205718
* Add a new subgroup to -Wtautological-compare, -Wtautological-overlap-compare,Richard Trieu2014-04-051-0/+58
| | | | | | | | | | | | | | which warns on compound conditionals that always evaluate to the same value. For instance, (x > 5 && x < 3) will always be false since no value for x can satisfy both conditions. This patch also changes the CFG to use these tautological values for better branch analysis. The test for -Wunreachable-code shows how this change catches additional dead code. Patch by Anders Rönnholm. llvm-svn: 205665
OpenPOWER on IntegriCloud