summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR13775: When checking for a tag type being shadowed by some other declaration,Richard Smith2012-09-061-19/+17
| | | | | | don't trample over the caller's LookupResult in the case where the check fails. llvm-svn: 163281
* c error recovery. treat an invalid redeclarationFariborz Jahanian2012-09-051-0/+3
| | | | | | | | of a c-function for what it is. Otherwise, this func is treated as an overloadable c-function resulting in a crash much later. // rdar://11743706 llvm-svn: 163224
* Changed the remaining dead asserts to llvm_unreachable.Joao Matos2012-09-011-7/+5
| | | | llvm-svn: 163039
* Improved MSVC __interface support by adding first class support for it, ↵Joao Matos2012-08-311-16/+60
| | | | | | instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
* The presence of a user-*declared* constructor makes the defaultDouglas Gregor2012-08-301-6/+6
| | | | | | | constructor not user provided (and, therefore, non-trivial). Fixes <rdar://problem/11736429>. llvm-svn: 162947
* Add -Wduplicate-enum warning. Clang will emit this warning when an implicitlyRichard Trieu2012-08-301-0/+177
| | | | | | | | | | | | | | | | initiated enum constant has the same value as another enum constant. For instance: enum test { A, B, C = -1, D, E = 1 }; Clang will warn that: A and D both have value 0 B and E both have value 1 A few exceptions are made to keep the noise down. Enum constants which are initialized to another enum constant, or an enum constant plus or minus 1 will not trigger this warning. Also, anonymous enums are not checked. llvm-svn: 162938
* CUDA: give static storage class to __shared__ and __constant__Peter Collingbourne2012-08-281-0/+8
| | | | | | | | variables without a storage class within a function, to implement CUDA B.2.5: "__shared__ and __constant__ variables have implied static storage [duration]." llvm-svn: 162788
* Fix the CC-matching logic for instance methods in the MS ABI.John McCall2012-08-251-2/+30
| | | | | | Patch by Timur Iskhodzhanov! llvm-svn: 162639
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-20/+15
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-12/+11
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Better wording for reference self-initialization warning.Hans Wennborg2012-08-201-1/+4
| | | | llvm-svn: 162198
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-181-24/+36
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* c: privide deprecated warning when __private_extern__ storageFariborz Jahanian2012-08-171-1/+3
| | | | | | | | specifier is unsed in a declaration; as it may not make the symbol local to linkage unit as intended. Suggest using "hidden" visibility attribute instead. // rdar://7703982 llvm-svn: 162138
* Warn about self-initialization of references.Hans Wennborg2012-08-171-6/+9
| | | | | | | Initializing a reference with itself, e.g. "int &a = a;" seems like a very bad idea. llvm-svn: 162093
* Don't do jump-scope checking when code completion is enabled. It'sDouglas Gregor2012-08-171-1/+2
| | | | | | | | both a waste of time, and prone to crash due to the use of the error-recovery path in parser. Fixes <rdar://problem/12103608>, which has been driving me nuts. llvm-svn: 162081
* Add support for "type safety" attributes that allow checking that 'void *'Dmitri Gribenko2012-08-171-0/+36
| | | | | | | | | | | | | | function arguments and arguments for variadic functions are of a particular type which is determined by some other argument to the same function call. Usecases include: * MPI library implementations, where these attributes enable checking that buffer type matches the passed MPI_Datatype; * for HDF5 library there is a similar usecase as MPI; * checking types of variadic functions' arguments for functions like fcntl() and ioctl(). llvm-svn: 162067
* objective-C++: issue diagnostic when ivar type isFariborz Jahanian2012-08-161-2/+8
| | | | | | an abstract c++ class. // rdar://12095239 llvm-svn: 162052
* Patch to warn about __private_extern__ on tentative definitionsFariborz Jahanian2012-08-151-0/+4
| | | | | | | | as it does something unexpected (but gcc compatible). Suggest use of __attribute__((visibility("hidden"))) on declaration instead. // rdar://7703982 llvm-svn: 161972
* Check local static variables for self reference on initialization.Richard Trieu2012-08-141-1/+1
| | | | llvm-svn: 161909
* Attaching comments to redeclarations: fix wrong assumptionsDmitri Gribenko2012-08-141-1/+3
| | | | | | | | | | | | | | | | | | The reason for the recent fallout for "attaching comments to any redeclaration" change are two false assumptions: (1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y' where we want the comment to be attached to both X and Y); (2) the whole redeclaration chain has only a single comment (obviously false, the user can put a separate comment for each redeclaration). To fix (1) I revert the part of the recent change where a 'Decl*' member was introduced to RawComment. Now ASTContext has a separate DenseMap for mapping 'Decl*' to 'FullComment*'. To fix (2) I just removed the test with this assumption. We might not parse every comment in redecl chain if we already parsed at least one. llvm-svn: 161878
* Provide isConst/Volatile on CXXMethodDecl.David Blaikie2012-08-101-2/+2
| | | | | | | | | This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce the implementation with other callers (& update those other callers). Patch contributed by Sam Panzer (panzer@google.com). llvm-svn: 161647
* Implicitly annotate __CFStringMakeConstantString with format_arg(1).Jordan Rose2012-08-081-0/+7
| | | | | | | | | We handled the builtin version of this function in r157968, but the builtin isn't used when compiling as -fno-constant-cfstrings. This should complete <rdar://problem/6157200>. llvm-svn: 161525
* Don't add attributes for "#pragma pack" and friends to tag declarations whichEli Friedman2012-08-081-3/+4
| | | | | | | are not definitions. This follows the behavior of both gcc and earlier versions of clang. Regression from r156531. <rdar://problem/12048621>. llvm-svn: 161523
* Get rid of an early return in Sema::ActOnFields which doesn't make sense ↵Eli Friedman2012-08-081-5/+0
| | | | | | | | | anymore. Fixes a crash (<rdar://problem/11067144>), and generally seems to improve recovery in other cases. llvm-svn: 161474
* Objective-C pointer types don't have C-linkage, even though they areDouglas Gregor2012-08-071-1/+2
| | | | | | non-POD. Fixes <rdar://problem/12031870>. llvm-svn: 161395
* For global record types, the self reference checker was called twice, resultingRichard Trieu2012-08-061-1/+4
| | | | | | | in duplicate -Wuninitialized warnings. Change so that only the check in TryConstructorInitialization() will be used and a single warning be emitted. llvm-svn: 161345
* PR13527: don't assert if a function is explicitly defaulted when it's alreadyRichard Smith2012-08-061-0/+1
| | | | | | been defined. llvm-svn: 161315
* Fix an assertion failure instantiating a constexpr function from within a ↵Eli Friedman2012-08-011-8/+10
| | | | | | -dealloc method. PR13401. llvm-svn: 161135
* Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko2012-07-311-0/+1
| | | | | | | | | | The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this breaks libclang binary compatibility, but should not be a problem since API is so new. This also fixes PR13372 as a side-effect. llvm-svn: 161087
* Improvements to vexing-parse warnings. Make the no-parameters case moreRichard Smith2012-07-301-55/+3
| | | | | | | | | | | | | accurate by asking the parser whether there was an ambiguity rather than trying to reverse-engineer it from the DeclSpec. Make the with-parameters case have better diagnostics by using semantic information to drive the warning, improving the diagnostics and adding a fixit. Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for declarations of the form 'T (*x)(...)', which seem to have a very high false positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'. llvm-svn: 160998
* Use the location of the copy assignment when diagnosing classes that are ↵Benjamin Kramer2012-07-301-4/+3
| | | | | | nontrivial because of it. llvm-svn: 160962
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-271-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* Disable the warning for missing prototypes for OpenCL kernels. Includes ↵Tanya Lattner2012-07-261-0/+4
| | | | | | testcase. llvm-svn: 160766
* Tweak warning text for returning incomplete type from extern "C" functions.Hans Wennborg2012-07-241-4/+5
| | | | | | | | | | A warning was added in r150128 for returning non-C compatible user-defined types from functions with C linkage. This makes the text more clear for the case when the type isn't decidedly non-C compatible, but incomplete. llvm-svn: 160681
* When we have an Objective-C object with non-trivial lifetime in aDouglas Gregor2012-07-231-1/+1
| | | | | | | | structor class under ARC, that struct/class does not have a trivial move constructor or move assignment operator. Fixes the rest of <rdar://problem/11738725>. llvm-svn: 160615
* Reset the layout of an ObjC class if we see an ivar in a categoryEric Christopher2012-07-191-0/+17
| | | | | | | | or implementation since we've now got a different layout. Fixes rdar://11842763 llvm-svn: 160526
* Removing a spurious comment, no functionality changes.Aaron Ballman2012-07-191-5/+0
| | | | llvm-svn: 160522
* Relaxed enumeration constant naming rules for scoped enumerators so they no ↵Aaron Ballman2012-07-191-6/+12
| | | | | | longer emit a diagnostic when the enumeration's name matches that of the class. Fixes PR13128. llvm-svn: 160490
* Merge visibility from previous decls before looking at visibility pragma. ThisRafael Espindola2012-07-171-4/+4
| | | | | | | is a bit fuzzy, but matches gcc behavior and existing code bases seem to depend on it. llvm-svn: 160364
* Record visibility pragmas when we see a tag declaration. We might use itRafael Espindola2012-07-171-0/+4
| | | | | | to build a type before seeing the definition. llvm-svn: 160339
* Without this patch clang warns onRafael Espindola2012-07-151-6/+36
| | | | | | | | | | | | | | | | | | | | | struct __attribute__((visibility("hidden"))) zed { }; struct __attribute__((visibility("hidden"))) zed; Which is a bit silly and got a lot noisier now that we correctly handle visibility pragmas. This patch fixes that and also has some extra quality improvements: * We now produce an error instead of a warning for struct __attribute__((visibility("hidden"))) zed { }; struct __attribute__((visibility("default"))) zed; * The "after definition" warning now points to the new attribute that is ignored instead of pointing to the declaration. llvm-svn: 160227
* Make const the argument of getDefinition.Rafael Espindola2012-07-151-4/+4
| | | | llvm-svn: 160226
* Use llvm::APSInt::isSameValue to compare for the same value.Eric Christopher2012-07-151-1/+1
| | | | | | Finishes rdar://11875995 llvm-svn: 160225
* Provide a special-case diagnostic when two class member functions instantiateRichard Smith2012-07-131-11/+16
| | | | | | | to the same signature. Fix a bug in the type printer which would cause this diagnostic to print wonderful types like 'const const int *'. llvm-svn: 160161
* Attaching comments to declarations during parsing: handle more Objective-C ↵Dmitri Gribenko2012-07-131-1/+0
| | | | | | declarations. llvm-svn: 160156
* Process #pragma visibility early in the parsing of class definitions. FixesRafael Espindola2012-07-121-4/+4
| | | | | | pr13338. llvm-svn: 160105
* Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko2012-07-111-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics implemented -- see testcases. I created a new TableGen file for comment diagnostics, DiagnosticCommentKinds.td, because comment diagnostics don't logically fit into AST diagnostics file. But I don't feel strongly about it. This also implements support for self-closing HTML tags in comment lexer and parser (for example, <br />). In order to issue precise diagnostics CommentSema needs to know the declaration the comment is attached to. There is no easy way to find a decl by comment, so we match comments and decls in lockstep: after parsing one declgroup we check if we have any new, not yet attached comments. If we do -- then we do the usual comment-finding process. It is interesting that this automatically handles trailing comments. We pick up not only comments that precede the declaration, but also comments that *follow* the declaration -- thanks to the lookahead in the lexer: after parsing the declgroup we've consumed the semicolon and looked ahead through comments. Added -Wdocumentation-html flag for semantic HTML errors to allow the user to disable only HTML warnings (but not HTML parse errors, which we emit as warnings in -Wdocumentation). llvm-svn: 160078
* Handle #pragma visibility in explicit specializations and enums.Rafael Espindola2012-07-111-6/+4
| | | | llvm-svn: 160057
* Don't process #pragma visibility during instantiation. The visibility of theRafael Espindola2012-07-111-1/+2
| | | | | | | instantiation depends on the template, its arguments and parameters, but not where it is instantiated. llvm-svn: 160034
* PR13293: Defer deduction of an auto type with a dependent declarator, such ↵Richard Smith2012-07-081-1/+4
| | | | | | as "auto (*f)(T t)". llvm-svn: 159908
OpenPOWER on IntegriCloud