summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move CapturedStmt parameters to CapturedDeclBen Langmuir2013-05-031-2/+2
| | | | | | | | | | | Move the creation of CapturedStmt parameters out of CodeGen and into Sema, making it easier to customize the outlined function. The ImplicitParamDecls are stored in the CapturedDecl using an ASTContext-allocated array. Differential Revision: http://llvm-reviews.chandlerc.com/D722 llvm-svn: 181043
* Fix very confusing indent in Sema.cpp.Daniel Jasper2013-04-301-6/+5
| | | | | | | This came up during my Euro LLVM 2013 talk on clang-format and I was asked to submit it :-). llvm-svn: 180772
* Small CapturedStmt improvementsBen Langmuir2013-04-291-1/+1
| | | | | | | | | | | | | Add a CapturedStmt.h similar to Lambda.h to reduce the typing required to get to the CapturedRegionKind enum. This also allows codegen to access this enum without including Sema/ScopeInfo.h. Also removes some duplicated code for capturing 'this' between CapturedStmt and Lambda. Differential Revision: http://llvm-reviews.chandlerc.com/D712 llvm-svn: 180710
* Sema for Captured StatementsTareq A. Siraj2013-04-161-1/+16
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Add an option to parse all comments as documentation commentsDmitri Gribenko2013-04-101-1/+2
| | | | | | Patch by Amin Shali. llvm-svn: 179180
* Suppress -Wunused-variable for variables declared in headers, which may inMatt Beaumont-Gay2013-04-101-2/+6
| | | | | | | | | | | fact be defined and used in another TU. Reshuffle some test cases because we suppress -Wunused-variable after we've emitted an error. This fixes PR15558. llvm-svn: 179138
* Add 178663 back.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, ↵Douglas Gregor2013-03-201-2/+3
| | | | | | and warn when a newly-imported module conflicts with an already-imported module. llvm-svn: 177577
* Don't try to typo-correct 'super' in an objc method.Argyrios Kyrtzidis2013-03-141-1/+7
| | | | | | | | | | | | | | | | | | | | | This created 2 issues: 1) Performance issue, since typo-correction with PCH/modules is rather expensive. 2) Correctness issue, since if it managed to "correct" 'super' then bogus compiler errors would be emitted, like this: 3.m:8:3: error: unknown type name 'super'; did you mean 'super1'? super.x = 0; ^~~~~ super1 t3.m:5:13: note: 'super1' declared here typedef int super1; ^ t3.m:8:8: error: expected identifier or '(' super.x = 0; ^ llvm-svn: 177126
* [modules] Check for delegating constructor cycles when building a module and ↵Argyrios Kyrtzidis2013-03-141-6/+6
| | | | | | don't write them out to the module file. llvm-svn: 177000
* Avoid computing the linkage too early. Don't invalidate it.Rafael Espindola2013-03-141-3/+3
| | | | | | | | | | | | | | | | | | Before this patch we would compute the linkage lazily and cache it. When the AST was modified in ways that could change the value, we would invalidate the cache. That was fairly brittle, since any code could ask for the a linkage before the correct value was available. We should change the API to one where the linkage is computed explicitly and trying to get it when it is not available asserts. This patch is a first step in that direction. We still compute the linkage lazily, but instead of invalidating a cache, we assert that the AST modifications didn't change the result. llvm-svn: 176999
* Add a hasExternalLinkage helper. No functionality change.Rafael Espindola2013-03-071-3/+3
| | | | llvm-svn: 176607
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-1/+1
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* [preprocessor] Split the MacroInfo class into two separate concepts, ↵Argyrios Kyrtzidis2013-02-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | MacroInfo class for the data specific to a macro definition (e.g. what the tokens are), and MacroDirective class which encapsulates the changes to the "macro namespace" (e.g. the location where the macro name became active, the location where it was undefined, etc.) (A MacroDirective always points to a MacroInfo object.) Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but splitting the concepts allows us to better model the effect of modules to the macro namespace (also as a bonus it allows better modeling of push_macro/pop_macro #pragmas). Modules can have their own macro history, separate from the local (current translation unit) macro history; MacroDirectives will be used to model the macro history (changes to macro namespace). For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created to indicate that "FOO" became active at the import location. Module "A" itself will contain another MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives will point to the same MacroInfo object. Introducing the separation of macro concepts is the first part towards better modeling of module macros. llvm-svn: 175585
* Add a new -Wundefined-inline warning for inline functions which are used but notNick Lewycky2013-02-011-20/+34
| | | | | | defined. Fixes PR14993! llvm-svn: 174158
* Remove elements from Sema.UndefinedInternals as functions are defined. AlsoNick Lewycky2013-01-311-26/+50
| | | | | | | filter the elements before emitting them into a PCH. No user-visible functionality change, except that PCH files may be smaller? llvm-svn: 174034
* Fix ODR-use of a MemberExpr to check before marking a pure function used. RemoveNick Lewycky2013-01-311-1/+1
| | | | | | a workaround for this bug from the -Wundefined-internals warning. llvm-svn: 174020
* Remove function that is newly dead as of r173538.Nick Lewycky2013-01-261-4/+0
| | | | llvm-svn: 173550
* Preserve Sema::UndefinedInternals across PCH boundaries. FixesNick Lewycky2013-01-261-16/+8
| | | | | | -Wundefined-internal warnings with PCH. llvm-svn: 173538
* The standard ARM C++ ABI dictates that inline functions areJohn McCall2013-01-251-1/+1
| | | | | | | | never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. llvm-svn: 173515
* Fixed trailing whitespace.Michael Gottesman2013-01-201-44/+44
| | | | llvm-svn: 172939
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Mark all subsequent decls used.Rafael Espindola2013-01-081-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | In the source static void f(); static void f(); template<typename T> static void g() { f(); } static void f() { } void h() { g<int>(); } the call to f refers to the second decl, but it is only marked used at the end of the translation unit during instantiation, after the third f decl has been linked in. With this patch we mark all subsequent decls used, so that it is easy to check if a symbol is used or not. llvm-svn: 171888
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-2/+2
| | | | llvm-svn: 171367
* Don't warn on unused member functions that are extern because of a typedef.Rafael Espindola2012-12-301-0/+3
| | | | llvm-svn: 171267
* Don't warn for undefined but used decls that are external because of a typedef.Rafael Espindola2012-12-291-0/+3
| | | | | | | | This fixes pr14736. It is fairly ugly, but I don't think we can do much better as we have to wait at least until the end of the typedef to know if the function will have external linkage or not. llvm-svn: 171240
* Fix a regression from the previous commit.Rafael Espindola2012-12-261-1/+5
| | | | | | | Template instantiation can set the canonical decl to used after subsequent decls have been chained, so we have to check that too. llvm-svn: 171088
* Use the most recent redecl to decide if it is needed.Rafael Espindola2012-12-261-1/+1
| | | | | | This fixes pr14691, which I think is a regression from r168519. llvm-svn: 171077
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-16/+16
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Reject uses of __int128 on platforms that don't support it. Also move the uglyRichard Smith2012-11-291-1/+1
| | | | | | | 'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be properly cleaned up. llvm-svn: 168856
* Use a .def file for most of the diagnostic options.Douglas Gregor2012-10-231-2/+1
| | | | llvm-svn: 166520
* Add a new warning -Wmissing-variable-declarations, to warn about variablesEli Friedman2012-10-231-0/+2
| | | | | | | | | defined without a previous declaration. This is similar to -Wmissing-prototypes, but for variables instead of functions. Patch by Ed Schouten. llvm-svn: 166498
* From Vassil Vassilev: enable Sema to deal with multiple ExternalSemaSources.Axel Naumann2012-10-181-2/+29
| | | | llvm-svn: 166208
* Pull ScopeInfo implementation into its own file.Jordan Rose2012-09-281-159/+0
| | | | | | | | | The infrastructure for -Warc-repeated-use-of-weak got a little too heavy to leave sitting at the top of Sema.cpp. No functionality change. llvm-svn: 164856
* -Warc-repeated-use-of-weak: check ivars and variables as well.Jordan Rose2012-09-281-60/+77
| | | | | | | | | | Like properties, loading from a weak ivar twice in the same function can give you inconsistent results if the object is deallocated between the two loads. It is safer to assign to a strong local variable and use that. Second half of <rdar://problem/12280249>. llvm-svn: 164855
* Add a warning (off by default) for repeated use of the same weak property.Jordan Rose2012-09-281-0/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivating example: if (self.weakProp) use(self.weakProp); As with any non-atomic test-then-use, it is possible a weak property to be non-nil at the 'if', but be deallocated by the time it is used. The correct way to write this example is as follows: id tmp = self.weakProp; if (tmp) use(tmp); The warning is controlled by -Warc-repeated-use-of-receiver, and uses the property name and base to determine if the same property on the same object is being accessed multiple times. In cases where the base is more complicated than just a single Decl (e.g. 'foo.bar.weakProp'), it picks a Decl for some degree of uniquing and reports the problem under a subflag, -Warc-maybe-repeated-use-of-receiver. This gives a way to tune the aggressiveness of the warning for a particular project. The warning is not on by default because it is not flow-sensitive and thus may have a higher-than-acceptable rate of false positives, though it is less noisy than -Wreceiver-is-weak. On the other hand, it will not warn about some cases that may be legitimate issues that -Wreceiver-is-weak will catch, and it does not attempt to reason about methods returning weak values. Even though this is not a real "analysis-based" check I've put the bug emission code in AnalysisBasedWarnings for two reasons: (1) to run on every kind of code body (function, method, block, or lambda), and (2) to suggest that it may be enhanced by flow-sensitive analysis in the future. The second (smaller) half of this work is to extend it to weak locals and weak ivars. This should use most of the same infrastructure. Part of <rdar://problem/12280249> llvm-svn: 164854
* Fix crash when a decltype expression in a trailing return type refers to theRichard Smith2012-09-251-0/+1
| | | | | | | | | | function being instantiated. An error recovery codepath was recursively performing name lookup (and triggering an unbounded stack of template instantiations which blew out the stack before hitting the depth limit). Patch by Wei Pan! llvm-svn: 164586
* Conditionally parse documentation comments in system headers byTed Kremenek2012-09-131-0/+3
| | | | | | | | | | passing -fretain-comments-from-system-headers. By default, the compiler no longer parses such documentation comments, as they can result in a noticeable compile time/PCH slowdown. Fixes <rdar://problem/11860820>. llvm-svn: 163778
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-2/+1
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* When code completion is enabled, don't do any work inDouglas Gregor2012-08-171-0/+5
| | | | | | Sema::ActOnEndOfTranslationUnit(). This is a (minor) optimization. llvm-svn: 162144
* Fix an assertion failure instantiating a constexpr function from within a ↵Eli Friedman2012-08-011-2/+0
| | | | | | -dealloc method. PR13401. llvm-svn: 161135
* Renamed RawComment kinds to avoid name clash.Abramo Bagnara2012-07-041-2/+2
| | | | llvm-svn: 159706
* patch to suggest 'static' function should be 'static inline' Fariborz Jahanian2012-06-271-3/+11
| | | | | | | when it appears to be unused and occurs in a header. // rdar://11202617 llvm-svn: 159282
* Add a warning about almost-Doxygen trailing comments: //< and /*< ... */Dmitri Gribenko2012-06-221-0/+18
| | | | llvm-svn: 159001
* Structured comment parsing, first step.Dmitri Gribenko2012-06-201-0/+5
| | | | | | | | | * Retain comments in the AST * Serialize/deserialize comments * Find comments attached to a certain Decl * Expose raw comment text and SourceRange via libclang llvm-svn: 158771
* Explicitly build __builtin_va_list.Meador Inge2012-06-161-0/+4
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* Look at incomplete FunctionTemplateDecls in order to determine whetherDaniel Jasper2012-06-141-0/+2
| | | | | | a CXXRecordDecl is complete. Fixes Bug 13086. llvm-svn: 158469
* Introduce -Wunused-private-field. If enabled, this warning detectsDaniel Jasper2012-06-061-0/+91
| | | | | | | unused private fields of classes that are fully defined in the current translation unit. llvm-svn: 158054
OpenPOWER on IntegriCloud