summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Consider calls from implict host device functions as valid in SemaCUDA.Jacques Pienaar2014-12-165-17/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | In SemaCUDA all implicit functions were considered host device, this led to errors such as the following code snippet failing to compile: struct Copyable { const Copyable& operator=(const Copyable& x) { return *this; } }; struct Simple { Copyable b; }; void foo() { Simple a, b; a = b; } Above the implicit copy assignment operator was inferred as host device but there was only a host assignment copy defined which is an error in device compilation mode. Differential Revision: http://reviews.llvm.org/D6565 llvm-svn: 224358
* Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev2014-12-1616-64/+66
| | | | | | | Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
* [OPENMP] Bugfix for processing of global variables in OpenMP regions.Alexey Bataev2014-12-1610-63/+289
| | | | | | | | Currently, if global variable is marked as a private OpenMP variable, the compiler crashes in debug version or generates incorrect code in release version. It happens because in the OpenMP region the original global variable is used instead of the generated private copy. It happens because currently globals variables are not captured in the OpenMP region. This patch adds capturing of global variables iff private copy of the global variable must be used in the OpenMP region. Differential Revision: http://reviews.llvm.org/D6259 llvm-svn: 224323
* Sema: Don't crash converting to bool from _AtomicDavid Majnemer2014-12-162-1/+5
| | | | | | | | | | | Turning our _Atomic L-value into an R-value removes its _Atomic-ness. However, we didn't update our 'FromType' which made ScalarTypeToBooleanCastKind think we were trying to pass it a non-scalar. This fixes PR21836. llvm-svn: 224322
* Improve handling of value dependent expressions in ↵Nick Lewycky2014-12-163-3/+55
| | | | | | __attribute__((enable_if)), both in the condition expression and at the call site. Fixes PR20988! llvm-svn: 224320
* AST: Fix the linkage of static vars in fn template specializationsDavid Majnemer2014-12-162-1/+20
| | | | | | | | | | | | We that static variables in function template specializations were externally visible. The manglers assumed that externally visible static variables were numbered in Sema. We would end up mangling static variables in the same specialization with the same mangling number which would give all of them the same name. This fixes PR21904. llvm-svn: 224316
* Clarify the code in checkDLLAttribute()Hans Wennborg2014-12-161-7/+12
| | | | | | | | Update the comments to make it more clear what's going on, and address Richard's comments from PR21718. This doesn't fix that bug, but hopefully makes the code easier to understand. llvm-svn: 224303
* Sema: Check value dependent casts when possibleDavid Majnemer2014-12-162-4/+5
| | | | | | | | | | We know that const_cast<char *>((void)Something) is ill-formed, even if 'Something' is dependent because you can't cast from void to a pointer type. This fixes PR21845. llvm-svn: 224299
* Diagnose function template definitions inside functionsReid Kleckner2014-12-156-6/+30
| | | | | | | | | | | | | | | The parser can only be tricked into parsing a function template definition by inserting a typename keyword before the function template declaration. This used to make us crash, and now it's fixed. While here, remove an unneeded boolean parameter from ParseDeclGroup. This boolean always corresponded to non-typedef declarators at file scope. ParseDeclGroup already has precise diagnostics for the function definition typedef case, so we can let that through. Fixes PR21839. llvm-svn: 224287
* Silene -Wreorder warning.Roman Divacky2014-12-151-1/+1
| | | | llvm-svn: 224279
* Handle errors in lambda prototype instantiation correctlyReid Kleckner2014-12-153-2/+34
| | | | | | | | | | | | Previously we would attempt to build a TypeSourceInfo for a null type, and then we would forget to pop the function scope before returning an error. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D6665 llvm-svn: 224271
* Sema: Cleanup and improve string-plus-char checking.Daniel Marjamaki2014-12-152-4/+19
| | | | | | Patch by Anders Rönnholm llvm-svn: 224268
* Update this testcase for the new metadata assembler syntax.Adrian Prantl2014-12-151-1/+1
| | | | llvm-svn: 224262
* IR: Make metadata typeless in assembly, clang sideDuncan P. N. Exon Smith2014-12-15119-838/+838
| | | | | | Match LLVM changes from r224257. llvm-svn: 224259
* Warn when attribute 'optnone' conflicts with attributes on aPaul Robinson2014-12-157-4/+86
| | | | | | different declaration of the same function. llvm-svn: 224256
* Add voidType() matcher.Samuel Benzaquen2014-12-153-0/+18
| | | | | | | | | | | | Summary: Add voidType() matcher. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6656 llvm-svn: 224250
* Sema: Don't diagnose string + int if the int is value dependentDavid Majnemer2014-12-152-1/+6
| | | | | | | | | | | Don't send a value dependent expression into the expression evaluator, HandleSizeof would crash. Making HandleSizeof handle dependent types would noisily warn about the operation even if everything turns out OK after instantiation. This fixes PR21848. llvm-svn: 224240
* Preprocessor: Recover instead of mutating a token in ExpandBuiltinMacroDavid Majnemer2014-12-152-5/+18
| | | | | | | | | | | We would CreateString on arbitrary garbage instead of just skipping to the end of the builtin macro. Eventually, this would cause us to crash because we would end up replacing the contents of a character token with a numeric literal. This fixes PR21825. llvm-svn: 224238
* Sema: Don't leave switch stack inconsistent when recoveringDavid Majnemer2014-12-153-2/+12
| | | | | | | | | We would exit Sema::ActOnFinishSwitchStmt early if we didn't have a body. This would leave an extra SwitchStmt on the SwitchStack. This fixes PR21841. llvm-svn: 224237
* Test for 'omp for' (for r224233).Alexander Musman2014-12-151-0/+91
| | | | llvm-svn: 224234
* First patch with codegen of the 'omp for' directive. It implementsAlexander Musman2014-12-159-257/+810
| | | | | | | | | | | | | | | the simplest case, which is used when no chunk_size is specified in the schedule(static) or no 'schedule' clause is specified - the iteration space is divided by the library into chunks that are approximately equal in size, and at most one chunk is distributed to each thread. In this case, we do not need an outer loop in each thread - each thread requests once which iterations range it should handle (using __kmpc_for_static_init runtime call) and then runs the inner loop on this range. Differential Revision: http://reviews.llvm.org/D5865 llvm-svn: 224233
* Parse: Don't reorder tokens using ConsumeTokenDavid Majnemer2014-12-152-1/+6
| | | | | | | | | ConsumeToken doesn't work with special tokens. Instead, just use PP.Lex to eat the token. This fixes PR21817. llvm-svn: 224232
* Fixed test/CodeGen/atomic_ops.c for compatibility with hexagon targetAlexey Bataev2014-12-151-3/+3
| | | | llvm-svn: 224231
* Bugfix for Codegen of atomic load/store/other ops.Alexey Bataev2014-12-156-89/+646
| | | | | | | Currently clang fires assertions on x86-64 on any atomic operations for long double operands. Patch fixes codegen for such operations. Differential Revision: http://reviews.llvm.org/D6499 llvm-svn: 224230
* MSVC: A wide string literal from L#macro_arg in a macroAlexey Bataev2014-12-153-5/+40
| | | | | | | | Clang should form a wide string literal from L#macro_arg in a function-like macro in -fms-compatibility mode. Fix for http://llvm.org/PR9984. Differential Revision: http://reviews.llvm.org/D6604 llvm-svn: 224228
* Don't break single-line raw string literals.Alexander Kornienko2014-12-142-41/+9
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6636 llvm-svn: 224223
* DebugInfo: More accurate line information for placement new.David Blaikie2014-12-142-3/+8
| | | | | | | | | | | This actually came up as a break in UBSan tests (look for a follow-up commit to this one to see the UBSan test fallout) when I tried a broader fix to location information. I have some other ideas about how to do that broader change & will keep looking into it. llvm-svn: 224221
* CodeGen: Compound literals with funny types shouldn't crashDavid Majnemer2014-12-144-5/+21
| | | | | | | | | | | | | | | | | CodeGen assumed that a compound literal with array type should have a corresponding LLVM IR array type. We had two bugs in this area: - Zero sized arrays in compound literals would lead to the creation of an opaque type. This is unnecessary, we should just create an array type with a bound of zero. - Funny record types (like unions) lead to exotic IR types for compound literals. In this case, CodeGen must be prepared to deal with the possibility that it might not have an array IR type. This fixes PR21912. llvm-svn: 224219
* AST: Limit zero-sized constexpr behavior to array typesDavid Majnemer2014-12-142-2/+5
| | | | | | | Restricting this "extension" to array types maximizes our standards conformance while not miscompiling real-world programs. llvm-svn: 224215
* Lex: Don't crash if both conflict markers are on the same lineDavid Majnemer2014-12-142-2/+4
| | | | | | | | | | We would check if the terminator marker is on a newline. However, the logic would end up out-of-bounds if the terminator marker immediately follows the start marker. This fixes PR21820. llvm-svn: 224210
* If a non-template constructor instantiated to X(X),John McCall2014-12-145-12/+83
| | | | | | | | | | | | | | | | | | | | | | | ignore it during overload resolution when initializing X from a value of type cv X. Previously, our rule here only ignored specializations of constructor templates. That's probably because the standard says that constructors are outright ill-formed if their first parameter is literally X and they're callable with one argument. However, Clang only enforces that prohibition against non-implicit instantiations; I'm not sure why, but it seems to be deliberate. Given that, the most sensible thing to do is to just ignore the "illegal" constructor regardless of where it came from. Also, stop ignoring such constructors silently: print a note explaining why they're being ignored. Fixes <rdar://19199836>. llvm-svn: 224205
* Sema: attribute((annotate)) must have at least one argumentDavid Majnemer2014-12-142-1/+2
| | | | | | | | | | Sema::handleAnnotateAttr expects that some basic validation is done on the given AttributeList. However, ProcessAccessDeclAttributeList called it directly. Instead, pass the list to ProcessDeclAttribute. This fixes PR21847. llvm-svn: 224204
* clang-cl: Fix handling of the /volatile flag (PR21893)Hans Wennborg2014-12-132-2/+4
| | | | | | | | The /volatile:iso flag is our default behaviour, so it can be ignored. Parse /volatile:ms as unsupported. llvm-svn: 224202
* clang-cl: ignore /cgthreads (PR21894)Hans Wennborg2014-12-132-0/+3
| | | | llvm-svn: 224201
* clang-cl: Make /Gd ignored instead of unsupportedHans Wennborg2014-12-132-1/+2
| | | | | | | /Gd is the default calling convention setting, so we don't need to take any action. llvm-svn: 224200
* clang-cl: Add unsupported /Gv option (PR21892)Hans Wennborg2014-12-132-0/+2
| | | | | | We don't currently support any of the calling convention options. llvm-svn: 224199
* Parse: MS property members cannot have an in-class initializerDavid Majnemer2014-12-134-5/+12
| | | | | | | | | We would crash trying to treat a property member as a field. These shoudl be forbidden anyway, reject programs which contain them. This fixes PR21840. llvm-svn: 224193
* Sema: Constexpr functions must have return statements which have an exprDavid Majnemer2014-12-133-4/+23
| | | | | | | | | | | | | | | clang lets programmers be pretty cavalier when it comes to void return statements in functions which have non-void return types. However, we cannot be so forgiving in constexpr functions: evaluation will go off the rails very quickly. Instead, keep the return statement in the AST but mark the function as invalid. Doing so gives us nice diagnostics while making constexpr evaluation halt. This fixes PR21859. llvm-svn: 224189
* NFC: Minor formatting fixWill Wilson2014-12-131-1/+1
| | | | llvm-svn: 224185
* Pretty print support for template arg enum constantsWill Wilson2014-12-133-3/+38
| | | | llvm-svn: 224184
* Fix two small bugs in typo correction. One assertion failure building member ↵Nick Lewycky2014-12-133-1/+28
| | | | | | | | expressions because the lookup finds a different name than the original, fixed by updating the LookupResult's name with the name of the found decl. Second is that we also diagnose delayed typo exprs in the index of an array subscript expression. The testcase shows a third bug with a FIXME in it. llvm-svn: 224183
* Implement feedback on r224172 in PR21899Reid Kleckner2014-12-132-15/+6
| | | | | | Based on suggestions from Kaelyn. llvm-svn: 224173
* Typo correction: Ignore temporary binding exprs after overload resolutionReid Kleckner2014-12-132-2/+27
| | | | | | | | Transformation of a CallExpr doesn't always result in a new CallExpr. Fixes PR21899. llvm-svn: 224172
* Implement the __builtin_call_with_static_chain GNU extension.Peter Collingbourne2014-12-1216-71/+275
| | | | | | | | | | | | | | | | The extension has the following syntax: __builtin_call_with_static_chain(Call, Chain) where Call must be a function call expression and Chain must be of pointer type This extension performs a function call Call with a static chain pointer Chain passed to the callee in a designated register. This is useful for calling foreign language functions whose ABI uses static chain pointers (e.g. to implement closures). Differential Revision: http://reviews.llvm.org/D6332 llvm-svn: 224167
* Frontend: Canonicalize to native paths when dumping module dependenciesJustin Bogner2014-12-122-5/+9
| | | | | | | | | | | | Mixed path separators (ie, both / and \\) can mess up the sort order of the VFS map when dumping module dependencies, as was recently exposed by r224055 and papered over in r224145. Instead, we should simply use native paths for consistency. This also adds a TODO to add handling of .. in paths. There was some code for this before r224055, but it was untested and probably broken. llvm-svn: 224164
* Allow module deps to be printed in an arbitrary orderReid Kleckner2014-12-121-5/+5
| | | | | | | The order is different between Windows and Unix for reasons unknown, but the compiler output appears to still be determinstic. llvm-svn: 224145
* Fix the issue of mangling of local anonymous unions (Itanium C++ ABI):Evgeny Astigeevich2014-12-125-27/+100
| | | | | | | | | | | | | | | | | | | | | | A discriminator is used for the first occurrence of a name. inline int f1 () { static union { int a; long int b; }; static union { int c; double d; }; return a+c; } The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c. Differential Revision: http://reviews.llvm.org/D6295 llvm-svn: 224131
* Don't break string literals in Java and JavaScript.Alexander Kornienko2014-12-122-0/+13
| | | | | | | | The proper way to break string literals in these languages is by inserting a "+" between parts which we don't support yet. So we disable string literal breaking until then. llvm-svn: 224120
* clang-format: Revamp nested block formatting.Daniel Jasper2014-12-126-90/+88
| | | | | | | | | | | | | | | | | | | | | | This fixed llvm.org/PR21804 and hopefully a few other strange cases. Before: if (blah_blah(whatever, whatever, [] { doo_dah(); doo_dah(); })) { } } After: if (blah_blah(whatever, whatever, [] { doo_dah(); doo_dah(); })) { } } llvm-svn: 224112
* CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatileDavid Majnemer2014-12-122-7/+42
| | | | | | | | | Don't inherit the volatile-ness of the input pointer to the volatile operation for memory allocated on the side. This fixes PR17306. llvm-svn: 224110
OpenPOWER on IntegriCloud