summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r245496 "[CUDA] Add appropriate host/device attribute to builtins."Artem Belevich2015-08-201-11/+0
| | | | | | It's breaking internal test. llvm-svn: 245592
* [CUDA] Add appropriate host/device attribute to builtins.Artem Belevich2015-08-191-0/+11
| | | | | | Differential Revision: http://reviews.llvm.org/D12122 llvm-svn: 245496
* [modules] When parsing the base specifiers of a parse-merged class, the currentRichard Smith2015-08-171-1/+3
| | | | | | | | context is the class itself but lookups should be performed starting with the lookup parent of the class (class and base members don't shadow types from the surrounding context because they have not been declared yet). llvm-svn: 245236
* [CONCEPTS] Add diagnostic; invalid tag when concept specifiedNathan Wilson2015-08-141-1/+9
| | | | | | | | | | | | Summary: Adding check to emit diagnostic for invalid tag when concept is specified and associated tests. Reviewers: rsmith, hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D11916 llvm-svn: 245123
* [Sema] main can't be declared as global variable, in C++.Davide Italiano2015-08-141-0/+16
| | | | | | | | | | | So, we now reject that. We also warn for any external-linkage global variable named main in C, because it results in undefined behavior. PR: 24309 Differential Revision: http://reviews.llvm.org/D11658 Reviewed by: rsmith llvm-svn: 245051
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-131-1/+0
| | | | | | | | | | After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
* Rename the non-coding style conformant functions in namespace BuiltinsEric Christopher2015-08-061-6/+4
| | | | | | to match the rest of their brethren and reformat the bits that need it. llvm-svn: 244186
* [AST] ArrayRefize template param list info setters. No functionality change ↵Benjamin Kramer2015-08-051-13/+5
| | | | | | intended. llvm-svn: 244028
* [CONCEPTS] Add concept to VarDecl and diagnostic for uninitialized variable ↵Nathan Wilson2015-08-031-0/+12
| | | | | | | | | | | | | | concept Summary: Add IsConcept bit to VarDecl::NonParmVarDeclBitfields and associated isConcept/setConcept member functions. Set IsConcept to true when 'concept' specifier is in variable declaration. Create diagnostic when variable concept is not initialized. Reviewers: fraggamuffin, hubert.reinterpretcast, faisalv, aaron.ballman, rsmith Subscribers: aemerson, cfe-commits Differential Revision: http://reviews.llvm.org/D11600 llvm-svn: 243876
* test commit; wrap ellipses in comment with bracketsNathan Wilson2015-07-311-1/+1
| | | | llvm-svn: 243776
* [Concepts] Add diagnostic: non template declarationHubert Tong2015-07-301-0/+6
| | | | | | | | | | | | | | | | Summary: Adding diagnostic for concepts declared as non template (function or variable) Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast Subscribers: nwilson, cfe-commits Differential Revision: http://reviews.llvm.org/D11490 Patch by Nathan Wilson! llvm-svn: 243690
* Use llvm::reverse to make a bunch of loops use foreach. NFC.Pete Cooper2015-07-301-3/+2
| | | | | | | | | | | | | | | | In llvm commit r243581, a reverse range adapter was added which allows us to change code such as for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) { in to for (const FieldDecl *I : llvm::reverse(Fields)) This commit changes a few of the places in clang which are eligible to use this new adapter. llvm-svn: 243663
* [AST] Turn the callbacks of lookupInBases and forallBases into a function_refBenjamin Kramer2015-07-251-41/+36
| | | | | | | | | This lets us pass functors (and lambdas) without void * tricks. On the downside we can't pass CXXRecordDecl's Find* members (which are now type safe) to lookupInBases directly, but a lambda trampoline is a small price to pay. No functionality change intended. llvm-svn: 243217
* Downgrade error about adding 'dllimport' to used free function to warning ↵Hans Wennborg2015-07-221-3/+9
| | | | | | | | (PR24215) The code will still work as it can reference the function via its thunk. llvm-svn: 242973
* [CONCEPTS] Add diagnostics: non-defining function; non-namespace scopeHubert Tong2015-07-221-0/+26
| | | | | | | | | | | | | | | | | | | | | Summary: Create diagnostic for function concept declaration which is not a definition. Create diagnostic for concept declaration which isn't in namespace scope. Create associated tests. Reviewers: rsmith, faisalv, fraggamuffin, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11027 Patch by Nathan Wilson! llvm-svn: 242899
* [modules] In C++, stop serializing and deserializing a list of declarations inRichard Smith2015-07-211-38/+7
| | | | | | | | | the identifier table. This is redundant, since the TU-scope lookups are also serialized as part of the TU DeclContext, and wasteful in a number of ways. We still emit the decls for PCH / preamble builds, since for those we want identical results, not merely semantically equivalent ones. llvm-svn: 242855
* [modules] Don't save uninteresting identifiers, and don't consider identifiersRichard Smith2015-07-191-1/+1
| | | | | | | to be interesting just because they are the name of a builtin. Reduces the size of an empty module by over 80% (~100KB). llvm-svn: 242650
* Disable #pragma redefine_extname for C++ code as it does not make sense in ↵Aaron Ballman2015-07-161-22/+27
| | | | | | | | such a context. Patch by Andrey Bokhanko! llvm-svn: 242420
* Add a "maximum TLS alignment" characteristic to the target info, so itPaul Robinson2015-07-141-0/+26
| | | | | | | | | | can be different from the normal variable maximum. Add an error diagnostic for when TLS variables exceed maximum TLS alignment. Currenty only PS4 sets an explicit maximum TLS alignment. Patch by Charles Li! llvm-svn: 242198
* [Sema] Emit a better diagnostic when variable redeclarations disagreeDavid Majnemer2015-07-141-3/+10
| | | | | | | | | | | We referred to all declaration in definitions in our diagnostic messages which is can be inaccurate. Instead, classify the declaration and emit an appropriate diagnostic for the new declaration and an appropriate note pointing to the old one. This fixes PR24116. llvm-svn: 242190
* Sema: Allow null names to be passed in to isAcceptableTagRedeclarationJustin Bogner2015-07-101-5/+5
| | | | | | | | | | | | | It's possible for TagRedeclarations to involve decls without a name, ie, anonymous enums. We hit some undefined behaviour if we bind these null names to the reference here. We never dereference the name, so it's harmless if it's null - make it a pointer to allow that. Fixes the Modules/submodules-merge-defs.cpp test under ubsan. llvm-svn: 241963
* Refactor to avoid long if-condition.Richard Smith2015-07-061-8/+23
| | | | llvm-svn: 241518
* PR24030, PR24033: Consistently check whether a new declaration conflicts withRichard Smith2015-07-061-24/+84
| | | | | | | | | | an existing using shadow declaration if they define entities of the same kind in different namespaces. We'd previously check this consistently if the using-declaration came after the other declaration, but not if it came before. llvm-svn: 241428
* DR1909: Diagnose all invalid cases of a class member sharing its name with ↵Richard Smith2015-07-061-6/+11
| | | | | | the class. llvm-svn: 241425
* When we see something that looks like a constructor with a return type, only ↵Richard Smith2015-07-061-5/+6
| | | | | | issue one error, not two. llvm-svn: 241424
* [modules] Don't require the 'inline' specifier when merging an inline function;Richard Smith2015-07-011-1/+1
| | | | | | any source of the inline nature is sufficient. llvm-svn: 241146
* Rework parsing of pure-specifiers. Perform the grammar matching andRichard Smith2015-06-301-27/+4
| | | | | | disambiguation in the parser rather than trying to do it in Sema. llvm-svn: 241032
* PR23942: a pure-specifier's integer literal must be spelled '0'Richard Smith2015-06-291-3/+18
| | | | llvm-svn: 241019
* [Sema] Unions cannot have virtual functions.Davide Italiano2015-06-271-0/+5
| | | | | | | | PR: PR23931 Differential Revision: http://reviews.llvm.org/D10752 Reviewed by: rsmith llvm-svn: 240889
* Fix #pragma redefine_extname when there is a local variable of the same ↵Aaron Ballman2015-06-251-2/+17
| | | | | | | | name. The local should not be renamed, only the externally-available declaration should be. Patch by Andrey Bokhanko! llvm-svn: 240653
* Replace __double_underscored type nullability qualifiers with ↵Douglas Gregor2015-06-241-6/+8
| | | | | | | | | | | | | | | | _Uppercase_underscored Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-4/+4
| | | | llvm-svn: 240353
* [modules] Add a flag to disable the feature that permits conflicting ↵Richard Smith2015-06-221-5/+9
| | | | | | | | | | | | redefinitions of internal-linkage symbols that are not visible. Such conflicts are an accident waiting to happen, and this feature conflicts with the desire to include existing headers into multiple modules and merge the results. (In an ideal world, it should not be possible to export internal linkage symbols from a module, but sadly the glibc and libstdc++ headers provide 'static inline' functions in a few cases.) llvm-svn: 240335
* Misc. cleanups suggested by Aaron BallmanDouglas Gregor2015-06-221-2/+1
| | | | llvm-svn: 240297
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-4/+4
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Sema: add a helper for enumerating the TST id (NFC)Saleem Abdulrasool2015-06-211-16/+21
| | | | | | | | | | The same pattern was repeated a few times. Create a trivial helper method to map the Type Specifier to an ID for the diagnostic. Flip the selection order on one of the diagnostic messages to get the same ordering across all of the messages. This makes the emission of the diagnostic slightly more legible by changing the cascading ternary into a switch in a function. NFC. llvm-svn: 240251
* Sema: convert decl + while loop into for loop (NFC)Saleem Abdulrasool2015-06-211-3/+2
| | | | | | Convert a hand rolled for loop into an explicit for loop. NFC. llvm-svn: 240245
* Extend type nullability qualifiers for Objective-C.Douglas Gregor2015-06-191-2/+6
| | | | | | | | | | | | | | | Introduce context-sensitive, non-underscored nullability specifiers (nonnull, nullable, null_unspecified) for Objective-C method return types, method parameter types, and properties. Introduce Objective-C-specific semantics, including computation of the nullability of the result of a message send, merging of nullability information from the @interface of a class into its @implementation, etc . This is the Objective-C part of rdar://problem/18868820. llvm-svn: 240154
* Introduce type nullability specifiers for C/C++.Douglas Gregor2015-06-191-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Introduces the type specifiers __nonnull, __nullable, and __null_unspecified that describe the nullability of the pointer type to which the specifier appertains. Nullability type specifiers improve on the existing nonnull attributes in a few ways: - They apply to types, so one can represent a pointer to a non-null pointer, use them in function pointer types, etc. - As type specifiers, they are syntactically more lightweight than __attribute__s or [[attribute]]s. - They can express both the notion of 'should never be null' and also 'it makes sense for this to be null', and therefore can more easily catch errors of omission where one forgot to annotate the nullability of a particular pointer (this will come in a subsequent patch). Nullability type specifiers are maintained as type sugar, and therefore have no effect on mangling, encoding, overloading, etc. Nonetheless, they will be used for warnings about, e.g., passing 'null' to a method that does not accept it. This is the C/C++ part of rdar://problem/18868820. llvm-svn: 240146
* [clang] Refactoring of conditions so they use isOneOf() instead of multiple ↵Daniel Marjamaki2015-06-181-1/+1
| | | | | | is(). llvm-svn: 240008
* [modules] Ensure that if we merge the definitions of two enumerations, thatRichard Smith2015-06-171-1/+0
| | | | | | making either of them visible makes the merged definition visible. llvm-svn: 239969
* [modules] Fix assert/crash when parsing and merging a definition of a class ↵Richard Smith2015-06-111-0/+16
| | | | | | with a base-specifier inside a namespace. llvm-svn: 239569
* [modules] Fix a few places where merging wasn't performed if modules was ↵Richard Smith2015-06-111-3/+4
| | | | | | disabled but local module visibilty was enabled. llvm-svn: 239504
* Do not parse members of incomplete class.Serge Pavlov2015-06-101-2/+4
| | | | | | | | | | If definition of a class is unknown and out-of-line definition of its member is encountered, do not parse the member declaration. This change fixes PR18542. Differential Revision: http://reviews.llvm.org/D8010 llvm-svn: 239483
* PR5172: Fix for a bug in pragma redefine_extname implementation:Alexander Musman2015-06-101-9/+15
| | | | | | | | | | | it doesn't work correctly when a structure is declared before pragma and then a function with the same name declared after pragma. Patch by Andrey Bokhanko Differential Revision: http://reviews.llvm.org/D10187 llvm-svn: 239466
* [modules] Support for merging a parsed definition of a static data member of ↵Richard Smith2015-05-191-14/+33
| | | | | | a class template into an imported but hidden definition. llvm-svn: 237647
* [modules] Move implicit creation of ImportDecls for #includes transformed ↵Richard Smith2015-05-181-1/+20
| | | | | | into module imports from the frontend into Sema where it belongs. llvm-svn: 237555
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-151-14/+36
| | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
* Make GNUInline consistent with whether we use traditional GNU inline semantics.Peter Collingbourne2015-05-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we were setting LangOptions::GNUInline (which controls whether we use traditional GNU inline semantics) if the language did not have the C99 feature flag set. The trouble with this is that C++ family languages also do not have that flag set, so we ended up setting this flag in C++ modes (and working around it in a few places downstream by also checking CPlusPlus). The fix is to check whether the C89 flag is set for the target language, rather than whether the C99 flag is cleared. This also lets us remove most CPlusPlus checks. We continue to test CPlusPlus when deciding whether to pre-define the __GNUC_GNU_INLINE__ macro for consistency with GCC. There is a change in semantics in two other places where we weren't checking both CPlusPlus and GNUInline (FunctionDecl::doesDeclarationForceExternallyVisibleDefinition and FunctionDecl::isInlineDefinitionExternallyVisible), but this change seems to put us back into line with GCC's semantics (test case: test/CodeGen/inline.c). While at it, forbid -fgnu89-inline in C++ modes, as GCC doesn't support it, it didn't have any effect before, and supporting it just makes things more complicated. Differential Revision: http://reviews.llvm.org/D9333 llvm-svn: 237299
* Give isCompatibleWithMSVC a better interfaceDavid Majnemer2015-05-111-2/+3
| | | | | | | We now use an enum which maps the marketing name (almost always a year) to the major version number. llvm-svn: 236967
OpenPOWER on IntegriCloud