summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Nuke stale code for separately importing the qualifer -- it's just partChandler Carruth2011-05-021-7/+0
| | | | | | of the QualifierLoc, and that's all we need to import now. llvm-svn: 130675
* Remove dead variable, flagged by gcc's -Wunused-but-set-variable.Nick Lewycky2011-05-021-2/+0
| | | | llvm-svn: 130674
* Remove dead variable flagged by gcc's -Wunused-but-set-variable. NoNick Lewycky2011-05-021-1/+0
| | | | | | functionality change. llvm-svn: 130673
* Remove a dead variable flagged by gcc's -Wunused-but-set-variable. NoNick Lewycky2011-05-021-2/+0
| | | | | | functionality change. llvm-svn: 130672
* Revise the representation of parameter scope data so that theJohn McCall2011-05-024-29/+60
| | | | | | | scope depth overlaps with the ObjCDeclQualifier, dropping memory usage back to previous levels. llvm-svn: 130671
* Add an optional field attached to a DeclRefExpr which points back to theChandler Carruth2011-05-018-23/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decl actually found via name lookup & overload resolution when that Decl is different from the ValueDecl which is actually referenced by the expression. This can be used by AST consumers to correctly attribute references to the spelling location of a using declaration, and otherwise gain insight into the name resolution performed by Clang. The public interface to DRE is kept as narrow as possible: we provide a getFoundDecl() which always returns a NamedDecl, either the ValueDecl referenced or the new, more precise NamedDecl if present. This way AST clients can code against getFoundDecl without know when exactly the AST has a split representation. For an example of the data this provides consider: % cat x.cc namespace N1 { struct S {}; void f(const S&); } void test(N1::S s) { f(s); using N1::f; f(s); } % ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc [...] void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1> (CallExpr 0x5b01df0 <line:6:3, col:6> 'void' (ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay> (DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)')) (ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp> (DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))) (DeclStmt 0x5b01ee0 <line:7:3, col:14> 0x5b01e40 "UsingN1::;") (CallExpr 0x5b01fc8 <line:8:3, col:6> 'void' (ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay> (DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f'))) (ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp> (DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))) Now we can tell that the second call is 'using' (no pun intended) the using declaration, and *which* using declaration it sees. Without this, we can mistake calls that go through using declarations for ADL calls, and have no way to attribute names looked up with using declarations to the appropriate UsingDecl. llvm-svn: 130670
* Store a parameter index and function prototype depth in everyJohn McCall2011-05-0114-77/+384
| | | | | | | | | | parameter node and use this to correctly mangle parameter references in function template signatures. A follow-up patch will improve the storage usage of these fields; here I've just done the lazy thing. llvm-svn: 130669
* Remove the NameQualifier struct, which was just a wrapper aroundChandler Carruth2011-05-013-23/+21
| | | | | | | | | NestedNameSpecifierLoc. It predates when we had such an object. Reference the NNSLoc directly in DREs, and embed it directly into the MemberNameQualifier struct. llvm-svn: 130668
* Several cosmetic changes, no functionality changed.Chandler Carruth2011-05-013-44/+38
| | | | | | | | | | Mostly trailing whitespace so that me editor nuking it doesn't muddy the waters of subsequent commits that do change functionality. Also nukes a stray statement that was harmless but redundant that I introduced in r130666. llvm-svn: 130667
* Move the state bits in DeclRefExpr out of the pointer union and intoChandler Carruth2011-05-014-52/+62
| | | | | | | | | | | | | | | a bitfield in the base class. DREs weren't using any bits here past the normal Expr bits, so we have plenty of room. This makes the common case of getting a Decl out of a DRE no longer need to do any masking etc. Also, while here, clean up code to use the accessor methods rather than directly poking these bits, and provide a nice comment for DREs that includes the information previously attached to the bits going into the pointer union. No functionality changed here, but DREs should be a tad faster now. llvm-svn: 130666
* Switch getAs to castAs (didn't know about this before!) and simplifyChandler Carruth2011-05-011-2/+2
| | | | | | some code. llvm-svn: 130665
* Remove a stale comment, it no longer applied after my cleanups.Chandler Carruth2011-05-011-8/+5
| | | | | | | Also fix several misspellings in my comments. I cannot spell, and cannot even be trusted to ask my editor how to spell apparently. llvm-svn: 130662
* Fixed source range for extern linkage specification without braces.Abramo Bagnara2011-05-011-0/+5
| | | | llvm-svn: 130660
* Add r130624 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.Rafael Espindola2011-05-011-2/+1
| | | | llvm-svn: 130659
* Based on the new information in the AST provided by r130628, writeChandler Carruth2011-05-014-15/+14
| | | | | | | | | | | 3 lines of code and improve a bunch of information in the libclang view of the code. Updates the two tests that exercise this with the new data, checking that each new source location actually points back to the declared template parameter. llvm-svn: 130656
* Move several more type traits' implementations into the AST. A few wereChandler Carruth2011-05-012-12/+42
| | | | | | already present in the AST, and I added the ones that weren't. llvm-svn: 130655
* Switch __is_scalar to use the isScalarType predicate rather thanChandler Carruth2011-05-011-6/+1
| | | | | | duplicating its logic. llvm-svn: 130654
* Have the array type traits build an expression with type 'size_t'Chandler Carruth2011-05-011-1/+8
| | | | | | | | | | instead of 'int'. The Embarcadero spec says 'unsigned int', not 'int'. That's what 'size_t' is on Windows, but for Clang using a 'size_t' that can be larger than int seems more appropriate. llvm-svn: 130653
* Remove an inapplicable and completely out of place comment. The type is in ↵Chandler Carruth2011-05-011-1/+1
| | | | | | fact 'bool'. llvm-svn: 130652
* Remove more dead code for emitting diagnostics. The callers of theseChandler Carruth2011-05-012-19/+8
| | | | | | | | | | | | | functions already precluded dependent types from reaching them. Also change one of the callers to not error when a trait is applied to a dependent type. This is a perfectly reasonable pattern, and both Unary and Binary type traits already support dependent types (by populating the AST with a nonce value). Remove the actual diagnostic, since these aren't errors. llvm-svn: 130651
* Improve traversing of BlockExprs in RecursiveASTVisitor.Argyrios Kyrtzidis2011-05-011-5/+12
| | | | llvm-svn: 130650
* Simplify the flow of some of the array type trait code.Chandler Carruth2011-05-011-13/+4
| | | | | | Completely remove a switch which selected between the same two types. llvm-svn: 130649
* Convert the expression trait evaluation to a static function andChandler Carruth2011-05-011-20/+19
| | | | | | | | | a switch with any default case. This both warns when an enumerator is missing and asserts if a value sneaks through despite the warning. While in there fix a bunch of coding style issues with this code. llvm-svn: 130648
* Remove the default case from the unary type trait evaluation function,Chandler Carruth2011-05-011-2/+1
| | | | | | | adding an unreachable annotation. Remarkably this one was already enumarting every trait. llvm-svn: 130647
* Remove a few more bogus returns when the switch covers all theChandler Carruth2011-05-011-4/+3
| | | | | | | | | enumerators. Also remove a default that led to llvm_unreachable to make another switch warn if any enumerators fail to be covered. llvm-svn: 130646
* Remove another default and a *completely* bogus return from a switchChandler Carruth2011-05-011-2/+2
| | | | | | | | over type traits. Add the missing trait from this switch that Clang's warning uncovered. llvm-svn: 130645
* Mark that this function ends in a covering switch statement with everyChandler Carruth2011-05-011-0/+2
| | | | | | | | case returning a value. Silences a GCC warning. llvm-svn: 130644
* Remove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.Chandler Carruth2011-05-014-11/+0
| | | | | | | | | | | As might be surmised from their names, these aren't type traits, they're expression traits. Amazingly enough, they're expression traits that we have, and fully implement. These "type" traits are even parsed from the same tokens as the expression traits. Luckily, the parser only tried the expression trait parsing for these tokens, so this was all just a pile of dead code. llvm-svn: 130643
* Fully implement delegating constructors!Alexis Hunt2011-05-0114-18/+194
| | | | | | | | | | As far as I know, this implementation is complete but might be missing a few optimizations. Exceptions and virtual bases are handled correctly. Because I'm an optimist, the web page has appropriately been updated. If I'm wrong, feel free to downgrade its support categories. llvm-svn: 130642
* More cleanup of the type traits implementation.Chandler Carruth2011-05-011-81/+110
| | | | | | | | | | | | | | | | | | | | 1) Moved the completeness checking routine above the evaluation routine so the reader sees that we do in fact check for complete types when necessary. 2) Remove the FIXME comment about not doing this. 3) Make the arguments to the evaluate function agree in order with those to the completeness checking function. 4) Completely specify the enumerators for the completeness checking function rather than relying on a default. 5) Remove a check for the Borland language to only require complete types in a few places. Borland's own documentation doesn't agree with this: some of the previously unspecified traits *do* require a complete type, some don't. 6) Correctly split the traits which do not require complete types from those that do, clarifying comments and citations to the standard or other documentation where relevant. llvm-svn: 130641
* Order the type traits according to the standard's listing of unary typeChandler Carruth2011-05-011-54/+79
| | | | | | | | | traits where possible. For the rest, group them and add some documentation regarding their origins. No functionality change intended. llvm-svn: 130639
* Begin cleaning up type trait expression implementations and settling onChandler Carruth2011-05-011-21/+21
| | | | | | a single pattern for implementing each. llvm-svn: 130638
* Add a triple to this test, otherwise it fails under MSVC because wchar_t is ↵Francois Pichet2011-05-011-1/+1
| | | | | | unsigned with the i686-pc-win32 triple. llvm-svn: 130636
* Improve the documentation for the two ObjCDeclQualifiers so that IJohn McCall2011-05-013-20/+23
| | | | | | stop considering whether I can compress them. :) llvm-svn: 130633
* Compress some bits. Only matters for MSVC, or if we everJohn McCall2011-05-013-66/+91
| | | | | | | devirtualize Decl (because bits can't get laid out in base classes if the base is POD). llvm-svn: 130632
* Switch the interface name for both TemplateTypeParmType andChandler Carruth2011-05-015-7/+7
| | | | | | | | | | | SubstTemplateTypeParmType to be 'getIdentifier' instead of 'getName' as it returns an identifier. This makes them more consistent with the NamedDecl interface. Also, switch back to using this interface to acquire the indentifier in TypePrinter.cpp. I missed this in r130628. llvm-svn: 130629
* Re-applies the patch first applied way back in r106099, withChandler Carruth2011-05-0117-65/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | accompanying fixes to make it work today. The core of this patch is to provide a link from a TemplateTypeParmType back to the TemplateTypeParmDecl node which declared it. This in turn provides much more precise information about the type, where it came from, and how it functions for AST consumers. To make the patch work almost a year after its first attempt, it needed serialization support, and it now retains the old getName() interface. Finally, it requires us to not attempt to instantiate the type in an unsupported friend decl -- specifically those coming from template friend decls but which refer to a specific type through a dependent name. A cleaner representation of the last item would be to build FriendTemplateDecl nodes for these, storing their template parameters etc, and to perform proper instantation of them like any other template declaration. They can still be flagged as unsupported for the purpose of access checking, etc. This passed an asserts-enabled bootstrap for me, and the reduced test case mentioned in the original review thread no longer causes issues, likely fixed at somewhere amidst the 24k revisions that have elapsed. llvm-svn: 130628
* Revert the previous patch while I figure out how to make llvm-gccRafael Espindola2011-04-301-1/+2
| | | | | | less agressive about disabling cfi on linux :-( llvm-svn: 130627
* Update for cfi.Rafael Espindola2011-04-301-2/+1
| | | | llvm-svn: 130624
* Remove unused function.Benjamin Kramer2011-04-301-14/+0
| | | | llvm-svn: 130622
* Remove noisy semicolons.Benjamin Kramer2011-04-302-2/+2
| | | | llvm-svn: 130621
* PR9792: Make sure to use the right definition of wchar_t when the defaultEli Friedman2011-04-302-1/+7
| | | | | | wchar_t is an unsigned type. llvm-svn: 130620
* Some small improvements to the builtin (-ffreestanding) stdint.h; inEli Friedman2011-04-302-13/+21
| | | | | | particular, make sure to handle WCHAR_MIN correctly. llvm-svn: 130618
* Pass -fno-dwarf2-cfi-asm and use FileCheck.Rafael Espindola2011-04-301-2/+8
| | | | llvm-svn: 130617
* Implement -fno-dwarf2-cfi-asm.Rafael Espindola2011-04-306-0/+16
| | | | llvm-svn: 130616
* When comparing parameters of reference-to-qualified type duringDouglas Gregor2011-04-304-2/+32
| | | | | | | | | partial ordering of function templates, use a simple superset relationship rather than the convertibility-implying isMoreQualifiedThan/compatibilyIncludes relationship. Fixes partial ordering between references and address-space-qualified references. llvm-svn: 130612
* Replace a literal 8 with Context->getCharWidth() inKen Dyck2011-04-301-1/+1
| | | | | | SynthesizeByrefCopyDestroyHelper(). No change in functionality intended. llvm-svn: 130608
* Make type-traits reflect that Clang's vectors act like scalar types.Chandler Carruth2011-04-303-4/+21
| | | | llvm-svn: 130606
* Switch the type-trait like APIs on the AST to only check for incompleteChandler Carruth2011-04-302-7/+30
| | | | | | | | | | | types after looking through arrays. Arrays with an unknown bound seem to be specifically allowed in the library type traits in C++0x, and GCC's builtin __is_trivial returns 'true' for the type 'int[]'. Now Clang agrees with GCC about __is_trivial here. Also hardens these methods against dependent types by just returning false. llvm-svn: 130605
* Extract a function to impose the completeness requirement on unary typeChandler Carruth2011-04-301-23/+76
| | | | | | | | | | | | | | | | | | | | | | trait arguments. Reflow the logic to use early exit instead of a complex condition expression. Switch to a switch for acting on different type traits and add a bunch of the recently implemented type traits here. This fixes one of the regressions with the new __is_standard_layout trait to again require a complete type. It also fixes some latent bugs in other traits that never did impose this despite the standard requiring it. However, all these bugs were hidden for non-borland systems where the default is to require a complete type. It's unclear to me what the best approach here is: providing an explicit lists for the ones requiring complete types only w/ Borland and using a default for the rest, or forcing this switch to enumerate the traits and make it clear which way each one goes. I'm still working on cleaning up the tests so that they actually catch this, a much more comprehensive update to the tests will come once I've worked through the bugs I'm finding via inspection. llvm-svn: 130604
OpenPOWER on IntegriCloud