summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Sema: Flexible array members were introduced in C99, diagnose their use in C++David Majnemer2013-11-021-1/+1
| | | | | | | The declaration of a flexible array member was correctly diagnosed as an extension in C89 mode but not in C++. llvm-svn: 193918
* Fix a C struct diagnostic regression introduced by r187504 (PR17762).Kaelyn Uhrain2013-10-311-1/+4
| | | | llvm-svn: 193799
* ARM: fix AST for __builtin_arm_strex callTim Northover2013-10-291-0/+8
| | | | | | | | | | | The AST was constructed so that this builtin returned the default BoolTy and since I'd opted for custom SemaChecking, I should have set it properly at that point. This caused an assertion failure when the types didn't match up with what we generated. This makes it return an IntTy, which is as good as anything. llvm-svn: 193606
* Remove REQUIRES aarch64-registered-target from testAlp Toker2013-10-261-1/+0
| | | | | | Registered targets don't matter for Sema tests, this passes fine. llvm-svn: 193485
* Add -Wstring-plus-char, which warns when adding char literals to C strings.Jordan Rose2013-10-251-0/+15
| | | | | | | | | | | Specifically, this warns when a character literal is added (using '+') to a variable with type 'char *' (or any other pointer to character type). Like -Wstring-plus-int, there is a fix-it to change "foo + 'a'" to "&foo['a']" iff the character literal is on the right side of the string. Patch by Anders Rönnholm! llvm-svn: 193418
* PR17666: Instead of allowing an initial identifier argument in any attributeRichard Smith2013-10-241-2/+2
| | | | | | | | | | | | which we don't think can't have one, only allow it in the tiny number of attributes which opts into this weird parse rule. I've manually checked that the handlers for all these attributes can in fact cope with an identifier as the argument. This is still somewhat terrible; we should move more fully towards picking the parsing rules based on the attribute, and make the Parse -> Sema interface more type-safe. llvm-svn: 193295
* Implements 64 bit microsoft record layout and adds lit tests to cover Warren Hunt2013-10-231-0/+2
| | | | | | | | | it. Also removes all of the microsoft C++ ABI related code from the itanium layout builder. Differential Revision: http://llvm-reviews.chandlerc.com/D2003 llvm-svn: 193290
* Consider hidden decls for isUsed checks.Rafael Espindola2013-10-221-0/+9
| | | | | | | | | | | | | | | | | This fixes pr17624. A FIXME from Richard Smith: It seems to me that the root cause is that a per-Decl 'used' flag doesn't really make much sense in the way we use it now. I think we should either track whether that particular declaration is used (with isUsed scanning the entire redecl chain), or we should only have one flag for the entire redeclaration chain (perhaps by always looking at the flag on either the most recent decl or the canonical decl). Modeling it as "is this declaration or any previous declaration used" is weird, and requires contortions like the loop at the end of Sema::MarkFunctionReferenced. llvm-svn: 193202
* Treat aliases as definitions.Rafael Espindola2013-10-222-0/+55
| | | | | | | | | | | | | | This fixes pr17639. Before this patch clang would consider void foo(void) __attribute((alias("__foo"))); a declaration. It now correctly handles it as a definition. Initial patch by Alp Toker. I added support for variables. llvm-svn: 193200
* New fix for pr17535.Rafael Espindola2013-10-221-0/+54
| | | | | | | | | | | | | | | | | | | This is a fixed version of r193161. In order to handle void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); it is not enough to delay aliases to the end of the TU, we have to do two passes over them to find if they are defined or not. This can be implemented by producing alias as we go and just doing the second pass at the end. This has the advantage that other parts of clang that were expecting alias to be processed in order don't have to be changed. This patch also handles cyclic aliases. llvm-svn: 193188
* Revert r193073 and the attempt to fix it in r193170.Chandler Carruth2013-10-221-1/+1
| | | | | | | | | | This patch wasn't reviewed, and isn't correctly preserving the behaviors relied upon by QT. I don't have a direct example of fallout, but it should go through the standard code review process. For example, it should never have removed the QT test case that was added when fixing those users. llvm-svn: 193174
* Revert "This patch causes clang to reject alias attributes that point to ↵Rafael Espindola2013-10-221-22/+0
| | | | | | | | | | | | | | | | undefined names. For example, with this patch we now reject" This reverts commit r193161. It broke void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); Looks like we have to fix pr17639 first :-( llvm-svn: 193162
* This patch causes clang to reject alias attributes that point to undefinedRafael Espindola2013-10-221-0/+22
| | | | | | | | | | | | names. For example, with this patch we now reject void f1(void) __attribute__((alias("g1"))); This patch is implemented in CodeGen. It is quiet a bit simpler and more compatible with gcc than implementing it in Sema. The downside is that the errors only fire during -emit-llvm. llvm-svn: 193161
* Fix to PR8880 (clang dies processing a for loop).Serge Pavlov2013-10-211-1/+1
| | | | | | | | | | | | | | | | Due to statement expressions supported as GCC extension, it is possible to put 'break' or 'continue' into a loop/switch statement but outside its body, for example: for ( ; ({ if (first) { first = 0; continue; } 0; }); ) Such usage must be diagnosed as an error, GCC rejects it. To recognize this and similar patterns the flags BreakScope and ContinueScope are temporarily turned off while parsing condition expression. Differential Revision: http://llvm-reviews.chandlerc.com/D1762 llvm-svn: 193073
* Switch attribute test line endings from CRLFAlp Toker2013-10-201-19/+19
| | | | | | The convention is LF unless specifically testing line endings. llvm-svn: 193056
* This is now passing. Uncomment and close out PR6281.Bill Wendling2013-10-171-4/+2
| | | | llvm-svn: 192869
* Add constant evaluation support for __builtin_isinf, __builtin_isfinite,Richard Smith2013-10-151-0/+52
| | | | | | __builtin_isnan, and __builtin_isnormal. Patch by Karthik Bhat! Tests by me. llvm-svn: 192729
* Lit tests for Microsoft C++ record layout.Warren Hunt2013-10-141-0/+241
| | | | | | | They weren't added with the rest of the microsoft record layout patch due me not doing svn add. llvm-svn: 192612
* Adds Microsoft compatiable C++ record layout code to clang.Warren Hunt2013-10-111-44/+44
| | | | llvm-svn: 192494
* Make test portable.Ted Kremenek2013-10-101-1/+1
| | | | llvm-svn: 192338
* Fix getIntegerTypeOrder() to properly handle enums by first unwrapping their ↵Ted Kremenek2013-10-101-0/+24
| | | | | | | | | | | | underlying integer type. This is a precondition for calling getIntegerRank(). Fixes an assertion failure in a test case involving vectors. Fixes <rdar://problem/15091442> Please somebody check this. llvm-svn: 192334
* Tighten diagnostics for calling conventions on variadic functionsHans Wennborg2013-10-092-8/+5
| | | | | | | | | | | | Follow-up from r192240. This makes it an error to use callee-cleanup conventions on variadic functions, except for __fastcall and __stdcall, which we ignore with a warning for GCC and MSVC compatibility. Differential Revision: http://llvm-reviews.chandlerc.com/D1870 llvm-svn: 192308
* Turn error about fastcall variadic function into warning in MS mode (PR12535)Hans Wennborg2013-10-081-0/+6
| | | | | | | | | | MSVC allows this and silently falls back to __cdecl for variadic functions. This patch turns Clang's error into a warning in MS mode and adds a test to make sure we generate correct code. Differential Revision: http://llvm-reviews.chandlerc.com/D1861 llvm-svn: 192240
* Split test to test -Wshadow with emmintrin.h more portable.Ted Kremenek2013-10-082-10/+11
| | | | llvm-svn: 192144
* Suppress useless -Wshadow warning when using _mm* macros from emmintrin.hTed Kremenek2013-10-071-0/+10
| | | | | | | | | | Fixes <rdar://problem/10679282>. I'm not completely satisfied with this patch. Sprinkling "diagnostic ignored" _Pragmas throughout this file is gross, but I couldn't suppress it for the entire file. llvm-svn: 192143
* Gracefully (and correctly) handle init of multiple union membersMatthew Curtis2013-10-031-1/+49
| | | | | | | | | | | | | | | We now emit warnings when doing so and code generation is consistent with GCC. Note that the C99 spec is unclear as to the precise behavior. See also ... Bug: http://llvm.org/bugs/show_bug.cgi?id=16644 and cfe-dev discussion: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-September/031918.html llvm-svn: 191890
* Implement ARM GNU-style interrupt attributeTim Northover2013-10-011-0/+16
| | | | | | | | | | This attribute allows users to use a modified C or C++ function as an ARM exception-handling function and, with care, to successfully return control to user-space after the issue has been dealt with. rdar://problem/14207019 llvm-svn: 191769
* Don't pass -print-stats to the driver, it is a -cc1 option only.Rafael Espindola2013-09-251-2/+1
| | | | llvm-svn: 191376
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-0/+9
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* Add specific warning flags for GNU ext in Sema.Eli Friedman2013-09-181-12/+101
| | | | | | | | | | | | | | | | | | | This patch adds the following, more specific warning flags: gnu-anonymous-struct gnu-compound-literal-initializer gnu-empty-struct gnu-flexible-array-initializer gnu-flexible-array-union-member gnu-folding-constant redeclared-class-member gnu-redeclared-enum gnu-union-cast gnu-variable-sized-type-not-at-end Patch by Peter Lewis. llvm-svn: 190972
* Recommited:Stepan Dyatkovskiy2013-09-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fix for PR16752. Second commit. PR16752: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth methods. Methods asks target for proper type for given bit width. 2. Fix handleModeAttr according to new methods in TargetInfo. Fixes: 1st Commit (Done): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Current): Fix SemaDeclAttr, handleModeAttr function. Also test/Sema/attr-mode.c was fixed. 'XC' mode test was disabled for PPC64 machines. llvm-svn: 190926
* Add the intrinsic __builtin_convertvectorHal Finkel2013-09-181-0/+17
| | | | | | | | | | | | | | | | | | LLVM supports applying conversion instructions to vectors of the same number of elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to cause such instructions to be generated when using builtin vector types. C-style casting on vectors is already defined in terms of bitcasts, and so cannot be used for these conversions as well (without leading to a very confusing set of semantics). As a result, this adds a __builtin_convertvector intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is intended to aid the creation of vector intrinsic headers that create generic IR instead of target-dependent intrinsics (in other words, this is a generic _mm_cvtepi32_ps). As noted in the documentation, the action of __builtin_convertvector is defined in terms of the action of a C-style cast on each vector element. llvm-svn: 190915
* ffreestanding shouldn't effect main() on win32David Majnemer2013-09-161-1/+1
| | | | llvm-svn: 190824
* Updated the way the ownership attributes are semantically diagnosed. Added ↵Aaron Ballman2013-09-161-0/+19
| | | | | | test cases for the semantics checks. llvm-svn: 190802
* Add error checking to reject neon_vector_type attribute on targets without NEON.Amara Emerson2013-09-163-2/+7
| | | | | | Patch by Artyom Skrobov. llvm-svn: 190801
* Updated the PCS calling convention to use the new checkStringLiteralArgument ↵Aaron Ballman2013-09-131-1/+2
| | | | | | helper function. llvm-svn: 190710
* As Aaron pointed out it's simpler to reject wide string availability attr ↵Benjamin Kramer2013-09-131-2/+0
| | | | | | messages in the parser. llvm-svn: 190706
* Guard availability and thread safety attributes against wide strings.Benjamin Kramer2013-09-131-0/+2
| | | | | | Found by inspection. llvm-svn: 190701
* The cleanup attribute no longer uses an unresolved, simple identifier as its ↵Aaron Ballman2013-09-111-5/+9
| | | | | | argument. Instead, it takes an expression that is fully resolved. llvm-svn: 190476
* PR5683: Issue a warning when subtracting pointers to types of zero size, andRichard Smith2013-09-101-0/+47
| | | | | | | treat such subtractions as being non-constant. Patch by Serge Pavlov! With a few tweaks by me. llvm-svn: 190439
* Attribute tablegen now understands that attribute arguments can be optional. ↵Aaron Ballman2013-09-091-2/+3
| | | | | | This allows for automated checking of the number of arguments expected vs number of arguments given for attributes. Greatly reduces the amount of manual checking required. llvm-svn: 190368
* Sema: Don't crash on visibility attributes with an identifier argument.Benjamin Kramer2013-09-091-0/+2
| | | | | | PR17105. llvm-svn: 190312
* Removing the endian attribute and updating associated test cases. This ↵Aaron Ballman2013-09-091-9/+1
| | | | | | functionality was never completely implemented, and this is an improvement over silently eating the attribute. llvm-svn: 190303
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-313-3/+14
| | | | | | argument list. llvm-svn: 189711
* Add ms_abi and sysv_abi attribute handling.Charles Davis2013-08-303-0/+32
| | | | | | Based on a patch by Benno Rice! llvm-svn: 189644
* Delete CC_Default and use the target default CC everywhereReid Kleckner2013-08-272-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Makes functions with implicit calling convention compatible with function types with a matching explicit calling convention. This fixes things like calls to qsort(), which has an explicit __cdecl attribute on the comparator in Windows headers. Clang will now infer the calling convention from the declarator. There are two cases when the CC must be adjusted during redeclaration: 1. When defining a non-inline static method. 2. When redeclaring a function with an implicit or mismatched convention. Fixes PR13457, and allows clang to compile CommandLine.cpp for the Microsoft C++ ABI. Excellent test cases provided by Alexander Zinenko! Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1231 llvm-svn: 189412
* Typo.David Majnemer2013-08-221-2/+2
| | | | llvm-svn: 188996
* gnu-flags.c test: relax the check a bitDmitri Gribenko2013-08-221-7/+1
| | | | | | | This tests warning flags, so no need to test for specific alignment which is platform-dependent. llvm-svn: 188993
* Analysis: Make %I in printf more reasonable, add more testsDavid Majnemer2013-08-221-1/+17
| | | | llvm-svn: 188992
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-0/+13
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
OpenPOWER on IntegriCloud