summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Function template version of the previous patch.Rafael Espindola2012-05-211-4/+5
| | | | llvm-svn: 157207
* Produce a hidden symbol for zed inRafael Espindola2012-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct HIDDEN foo { }; template <class P> struct bar { }; template <> struct HIDDEN bar<foo> { DEFAULT static void zed(); }; void bar<foo>::zed() { } Before we would produce a hidden symbol in struct HIDDEN foo { }; template <class P> struct bar { }; template <> struct bar<foo> { DEFAULT static void zed(); }; void bar<foo>::zed() { } But adding HIDDEN to the specialization would cause us to produce a default symbol. llvm-svn: 157206
* Fix the visibility of instantiations of static data members.Rafael Espindola2012-05-161-2/+12
| | | | | | Fixes pr12835. llvm-svn: 156897
* Fix our handling of visibility in explicit template instantiations.Rafael Espindola2012-05-151-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | * Don't copy the visibility attribute during instantiations. We have to be able to distinguish struct HIDDEN foo {}; template<class T> DEFAULT void bar() {} template DEFAULT void bar<foo>(); from struct HIDDEN foo {}; template<class T> DEFAULT void bar() {} template void bar<foo>(); * If an instantiation has an attribute, it takes precedence over an attribute in the template. * With instantiation attributes handled with the above logic, we can now select the minimum visibility when looking at template arguments. llvm-svn: 156821
* Use raw_ostream in TypePrinter and eliminate uses of temporary std::strings.Argyrios Kyrtzidis2012-05-051-3/+1
| | | | | | Part of rdar://10796159 llvm-svn: 156228
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-3/+3
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Fix visibility when we have two types with explicit visibility in a templateRafael Espindola2012-04-231-3/+3
| | | | | | argument list. llvm-svn: 155368
* Inline helper function into only caller.Rafael Espindola2012-04-231-1/+1
| | | | llvm-svn: 155352
* An attribute in a explicit template installation should take precedence overRafael Espindola2012-04-221-2/+2
| | | | | | | | | | | the tempale arguments in deciding the visibility. This agrees with gcc 4.7. Found by trying to build chrome with component=shared_library with 155314 reverted. llvm-svn: 155316
* Fix handling of template parameters. Found by inspection. GCC 4.7 agreesRafael Espindola2012-04-221-3/+1
| | | | | | with this testcase. llvm-svn: 155301
* All the members of LVFlags always have the same value, replace the class withRafael Espindola2012-04-211-68/+46
| | | | | | a boolean. llvm-svn: 155299
* In mergeVisibility, if we already have an explicit visibility, keep it.Rafael Espindola2012-04-191-7/+11
| | | | | | | | This fixes the included testcase and lets us simplify the code a bit. It does require using mergeWithMin when merging class information to its members. Expand the comments to explain why that works. llvm-svn: 155103
* Now that we check visibility attributes in an appropriate order,Rafael Espindola2012-04-191-1/+1
| | | | | | | | | | | | | | | | | | there is no need for mergeVisibily to ever increase the visibility. Not doing so lets us replace an incorrect use of mergeVisibilityWithMin. The testcase struct HIDDEN RECT { int top; }; DEFAULT RECT foo = {0}; shows that we should give preference to one of the attributes instead of keeping the minimum. We still get this testcase wrong because mergeVisibily handles two explicit visibilities incorrectly, but this is a step in the right direction. llvm-svn: 155101
* Check ConsiderGlobalVisibility before using -fvisibility.Rafael Espindola2012-04-191-2/+4
| | | | llvm-svn: 155100
* The explicit bit in LV already tracks exactly the same information asRafael Espindola2012-04-191-6/+2
| | | | | | DHasExplicitVisibility. Simplify the code a bit. llvm-svn: 155099
* Move the point in the code where we handle -fvisibility=hidden. WithRafael Espindola2012-04-191-2/+4
| | | | | | | | | | | | the current implementation this should be a nop as explicit visibility takes precedence in mergeVisibility. The location chosen is such that attributes checked above it can force a symbol to be default. For example, an attribute is the variable or function. Attributes checked after this point, can only make the visibility more restrictive. An attribute in a type for example. llvm-svn: 155098
* Make setVisibility private and change users to mergeVisibility. This isRafael Espindola2012-04-191-7/+7
| | | | | | | | currently a nop as those users are the first merge or are a merge of a hidden explicit visibility, which always wins in the current implementation. llvm-svn: 155095
* Calling setVisibility directly only makes (some) sense when the visibility isRafael Espindola2012-04-181-3/+3
| | | | | | explicit. llvm-svn: 154969
* Simplify calls to mergeVisibility* by passing in the LinkageInfo. NoRafael Espindola2012-04-171-3/+2
| | | | | | functionality change. llvm-svn: 154940
* Revert r154749 for now at John McCall's request.Rafael Espindola2012-04-161-19/+19
| | | | llvm-svn: 154846
* Use ordering and the explicit visibility bit instead of modifyingRafael Espindola2012-04-161-44/+36
| | | | | | ConsiderGlobalVisibility. No functionality change. llvm-svn: 154843
* Add another constructor to LVFlags and use it to simplify the code a bit.Rafael Espindola2012-04-161-18/+10
| | | | llvm-svn: 154814
* Consider visibility attributes last, so that they take precedence.Rafael Espindola2012-04-141-21/+21
| | | | | | I am working on a cleaner fix, but this gets the case in PR12552 passing. llvm-svn: 154749
* When we form a new function/class template specialization, we firstDouglas Gregor2012-03-281-16/+1
| | | | | | | | | | | search for the specialization (in a folding set) and, if not found form a *Decl that is then inserted into that folding set. In rare cases, the folding set may be reallocated between the search and the insertion, causing a crash. No test case, because triggering rehashing consistently in a small test case is not feasible. Fixes <rdar://problem/11115071>. llvm-svn: 153575
* Introduce a new libclang API to determine the parent context of a codeDouglas Gregor2012-03-271-1/+1
| | | | | | | | | completion item. For example, if the code completion itself represents a declaration in a namespace (say, std::vector), then this API retrieves the cursor kind and name of the namespace (std). Implements <rdar://problem/11121951>. llvm-svn: 153545
* Support for definitions of member enumerations of class templates outside theRichard Smith2012-03-231-0/+18
| | | | | | | class template's definition, and for explicit specializations of such enum members. llvm-svn: 153304
* Instantiating a class template should not instantiate the definition of anyRichard Smith2012-03-141-0/+13
| | | | | | | | scoped enumeration members. Later uses of an enumeration temploid as a nested name specifier should cause its instantiation. Plus some groundwork for explicit specialization of member enumerations of class templates. llvm-svn: 152750
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-22/+22
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* The type of a definition should not increase its visibility. Fixes PR12221.Rafael Espindola2012-03-101-2/+2
| | | | llvm-svn: 152493
* [AST] Reduce Decl::getASTContext() calls.Daniel Dunbar2012-03-091-8/+10
| | | | | | | - This function is not at all free; pass it around along some hot paths instead of recomputing it deep inside various VarDecl methods. llvm-svn: 152363
* Untangle getUnderlyingDeclImpl, no functionality change.Benjamin Kramer2012-03-081-9/+7
| | | | llvm-svn: 152339
* [AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and ↵Daniel Dunbar2012-03-081-1/+1
| | | | | | incredibly common) path. llvm-svn: 152321
* Loosen the precondition of isCXXInstanceMember() to simply returnDouglas Gregor2012-03-081-3/+3
| | | | | | "false" for declarations that aren't members of classes. Fixes PR12106. llvm-svn: 152284
* [AST] VarDecl::hasDefinition() - Early exit if we find a strong definition.Daniel Dunbar2012-03-061-1/+4
| | | | llvm-svn: 152166
* [AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContextDaniel Dunbar2012-03-061-2/+5
| | | | | | -- which is very much not free -- in the common case. llvm-svn: 152165
* Ensure that we instantiate static reference data members of class templatesRichard Smith2012-03-021-6/+13
| | | | | | | | | early, since their values can be used in constant expressions in C++11. For odr-use checking, the opposite change is required, since references are odr-used whether or not they satisfy the requirements for appearing in a constant expression. llvm-svn: 151881
* Reapply r151638 and r151641.James Molloy2012-02-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation. These are now fixed, with regression tests added to catch them both (not Darwin-specific). Original log: ==================== Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h Original log: --------------------- Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. --------------------- I also reverted r151641 which was enhancement on top of r151638. ==================== llvm-svn: 151712
* Revert r151638 because it causes assertion hit on PCH creation for Cocoa.hArgyrios Kyrtzidis2012-02-281-10/+0
| | | | | | | | | | | | | | | | | | | | Original log: --------------------- Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. --------------------- I also reverted r151641 which was enhancement on top of r151638. llvm-svn: 151667
* Correctly track tags and enum members defined in the prototype of a ↵James Molloy2012-02-281-0/+10
| | | | | | | | | | | | | | | function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. llvm-svn: 151638
* Two fixes to how we compute visibility:Rafael Espindola2012-02-231-19/+25
| | | | | | | | | | | | * Handle some situations where we should never make a decl more visible, even when merging in an explicit visibility. * Handle attributes in members of classes that are explicitly specialized. Thanks Nico for the report and testing, Eric for the initial review, and dgregor for the awesome test27 :-) llvm-svn: 151236
* Implement non-internal linkage for lambda closure types that need aDouglas Gregor2012-02-211-0/+26
| | | | | | | | | stable mangling, since these lambdas can end up in multiple translation units. Sema is responsible for deciding when this is the case, because it's already responsible for choosing the mangling number. llvm-svn: 151029
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-15/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Make FunctionDecl::doesDeclarationForceExternallyVisibleDefinition use the ↵Eli Friedman2012-02-071-26/+68
| | | | | | same logic as FunctionDecl::isInlineDefinitionExternallyVisible to figure out whether to emit a definition. Based on work by Anton Yartsev. llvm-svn: 149963
* Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in ↵Eli Friedman2012-02-061-1/+1
| | | | | | C++11 mode. PR11928. llvm-svn: 149908
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-041-0/+15
| | | | | | | | | of Diagnostic.h. Fix all the files that depended on transitive includes of Diagnostic.h. With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer. llvm-svn: 149781
* Add a new compiler warning, which flags anti-patterns used as the sizeAnna Zaks2012-02-011-0/+7
| | | | | | | | | | | argument in strncat. The warning is ignored by default since it needs more qualification. TODO: The warning message and the note are messy when strncat is a builtin due to the macro expansion. llvm-svn: 149524
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-3/+0
| | | | llvm-svn: 148577
* Constify FunctionDecl::getmemoryFunctionKind().Anna Zaks2012-01-181-1/+1
| | | | llvm-svn: 148369
* Use Builtin ID as the return valueAnna Zaks2012-01-171-23/+26
| | | | | | | | | | for FunctionDecl::getMemoryFunctionKind(). This is a follow up on the Chris's review for r148142: We don't want to pollute FunctionDecl with an extra enum. (To make this work, added memcmp and family to the library builtins.) llvm-svn: 148267
* Change linkage computation so it doesn't depend on FunctionDecl::isExternC ↵Eli Friedman2012-01-151-39/+27
| | | | | | | | or VarDecl::isExternC, and instead queries what it actually cares about: whether the given declaration is inside an extern "C" context. Fundamentally, figuring out whether a function/variable uses C linkage requires knowing the linkage, and the logic in FunctionDecl::isExternC and VarDecl::isExternC was getting it wrong. Given that, fix FunctionDecl::isExternC and VarDecl::isExternC to use much simpler implementations that depend on the fixed linkage computation. Fixes a regression to test/SemaCXX/linkage.cpp caused by a new warning exposing the fact that the internal state was wrong. llvm-svn: 148207
OpenPOWER on IntegriCloud