summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* Add streamed versions of getQualifiedNameAsString.Benjamin Kramer2013-02-233-10/+32
| | | | | | Move the cold virtual method getNameForDiagnostic out of line. llvm-svn: 175966
* Remove the hack that avoided mangling static functions in extern C contexts.Rafael Espindola2013-02-231-9/+0
| | | | | | | | | | | | | | | | | Weather we should give C language linkage to functions and variables with internal linkage probably depends on how much code assumes it. The standard says they should have no language linkage, but gcc and msvc assign them C language linkage. This commit removes the hack that was preventing the mangling on static functions declare in extern C contexts. It is an experiment to see if we can implement the rules in the standard. If it turns out that many users depend on these functions and variables having C language linkage, we should change isExternC instead and try to convince the CWG to change the standard. llvm-svn: 175937
* Revert r175912, "Add support for coldcc to clang" at John's request.Peter Collingbourne2013-02-233-6/+0
| | | | llvm-svn: 175936
* objective-C arg: provide fixit support whenFariborz Jahanian2013-02-221-8/+12
| | | | | | | c++'s named cast need be replaced for bridge casting. // rdar://12788838 llvm-svn: 175923
* Add support for coldcc to clangPeter Collingbourne2013-02-223-0/+6
| | | | llvm-svn: 175912
* [Sema] Semantic analysis for empty-declaration and attribute-declaration.Michael Han2013-02-223-0/+18
| | | | | | | | Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these attributes can be sema checked just as attributes attached to "normal" declarations. llvm-svn: 175900
* Use raw_ostream::indent, update comment.Benjamin Kramer2013-02-221-4/+3
| | | | llvm-svn: 175897
* Push the raw_ostream through the template diffing code.Benjamin Kramer2013-02-221-17/+11
| | | | llvm-svn: 175896
* Streamify FormatASTNodeDiagnosticArgument.Benjamin Kramer2013-02-221-35/+33
| | | | llvm-svn: 175895
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-228-199/+42
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Comment parsing: add CommentOptions to allow specifying custom comment block ↵Dmitri Gribenko2013-02-222-6/+30
| | | | | | | | | | | | | | | | commands Add an ability to specify custom documentation block comment commands via a new class CommentOptions. The intention is that this class will hold future customizations for comment parsing, including defining documentation comments with specific numbers of parameters, etc. CommentOptions instance is a member of LangOptions. CommentOptions is controlled by a new command-line parameter -fcomment-block-commands=Foo,Bar,Baz. llvm-svn: 175892
* StmtPrinter: Directly print types to the stream instead of taking a detour ↵Benjamin Kramer2013-02-222-56/+69
| | | | | | through getAsString. llvm-svn: 175891
* Teach -ast-print how to print trailing-return-types.Richard Smith2013-02-221-2/+6
| | | | llvm-svn: 175864
* Decl.cpp/mergeTemplateLV(): Tweak a description. [-Wdocumentation]NAKAMURA Takumi2013-02-221-1/+1
| | | | llvm-svn: 175859
* Ignore visibility from enclosing template argumentsJohn McCall2013-02-212-61/+141
| | | | | | for explicit member specializations. llvm-svn: 175827
* AST dumping: dump template instantiations only onceDmitri Gribenko2013-02-211-2/+8
| | | | | | | | Fixes infinite loop in PR15220. Patch by Philip Craig. llvm-svn: 175805
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-215-15/+15
| | | | llvm-svn: 175705
* Rename TypeLoc's isType to isKindDavid Blaikie2013-02-211-3/+3
| | | | | | | | | | Matches changes made to SVal's similar functions based on Jordan Rose's review feedback to r175594. Also change isKind to take a reference rather than a non-null pointer, while I'm at it. (& make TypeLoc::isKind private) llvm-svn: 175704
* Remove commented out code.Richard Trieu2013-02-211-1/+1
| | | | llvm-svn: 175699
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-206-57/+46
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Add a new 'type_visibility' attribute to allow users toJohn McCall2013-02-201-62/+165
| | | | | | | | | | | | | | control the visibility of a type for the purposes of RTTI and template argument restrictions independently of how visibility propagates to its non-type member declarations. Also fix r175326 to not ignore template argument visibility on a template explicit instantiation when a member has an explicit attribute but the instantiation does not. The type_visibility work is rdar://11880378 llvm-svn: 175587
* Add support for -fvisibility-ms-compat.John McCall2013-02-191-5/+12
| | | | | | | | | | | | | | | We treat this as an alternative to -fvisibility=<?> which changes the default value visibility to "hidden" and the default type visibility to "default". Expose a -cc1 option for changing the default type visibility, repurposing -fvisibility as the default value visibility option (also setting type visibility from it in the absence of a specific option). rdar://13079314 llvm-svn: 175480
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-185-24/+25
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* Rework the visibility computation algorithm in preparationJohn McCall2013-02-161-186/+303
| | | | | | | | | | | | | | | | for distinguishing type vs. value visibility. The changes to the visibility of explicit specializations are intentional. The change to the "ugly" test case is a consequence of a sensible implementation, and I am happy to argue that this is better behavior. Other changes may or may not be intended; it is quite difficult to divine intent from some of the code I altered. I've left behind a comment which I hope explains the philosophy behind visibility computation. llvm-svn: 175326
* objective-C: Fixes a compiler crash when encodingFariborz Jahanian2013-02-151-4/+10
| | | | | | | an ivar of type pointer to a typedef'ed object. // rdar://13190095 llvm-svn: 175298
* Make helper functions static.Benjamin Kramer2013-02-151-2/+1
| | | | llvm-svn: 175265
* objective-C: synthesize properties in order of theirFariborz Jahanian2013-02-141-4/+8
| | | | | | | | declarations to synthesize their ivars in similar determinstic order so they are laid out in a determinstic order. // rdar://13192366 llvm-svn: 175214
* Mangle extern "C" functions whose names are not simple identifiers.Rafael Espindola2013-02-141-2/+6
| | | | llvm-svn: 175166
* Remove const_casts by making spec_begin()/spec_end() constDmitri Gribenko2013-02-142-9/+7
| | | | llvm-svn: 175159
* Partially revert r175117 so that we don't break assumptions about howRafael Espindola2013-02-141-0/+9
| | | | | | | static functions in extern "C" contexts are mangled. Should fix the bootstrap. llvm-svn: 175132
* merge hasCLanguageLinkage and isExternC. Keep the shorter name.Rafael Espindola2013-02-142-62/+32
| | | | | | | | | | I added hasCLanguageLinkage while fixing some language linkage bugs some time ago so that I wouldn't have to check all users of isExternC. It turned out to be a much longer detour than expected, but this patch finally merges the two again. The isExternC function now implements just the standard notion of having C language linkage. llvm-svn: 175119
* Add a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fixRafael Espindola2013-02-143-24/+41
| | | | | | | | | | | | | | | some cases where functions with no language linkage were being treated as having C language linkage. In particular, don't warn in extern "C" { static NonPod foo(); } Since getLanguageLinkage checks the language linkage, the linkage computation cannot use the language linkage. Break the loop by checking just the context in the linkage computation. llvm-svn: 175117
* objective-C: Make order of ivars which are synthesizedFariborz Jahanian2013-02-131-7/+40
| | | | | | | | in the course of property synthesis deterministic (ordered by their type size), instead of having hashtable order (as it is currently). // rdar://13192366 llvm-svn: 175100
* Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058Timur Iskhodzhanov2013-02-132-19/+73
| | | | llvm-svn: 175045
* Fix a bug reduced from a crash when trying to use modules with libc++. We checkRichard Smith2013-02-121-4/+1
| | | | | | | | the linkage of functions and variables while merging declarations from modules, and we don't necessarily have enough of the rest of the AST loaded at that point to allow us to compute linkage, so serialize it instead. llvm-svn: 174943
* Don't bother reconciling external visible decls against our current set ofRichard Smith2013-02-111-11/+5
| | | | | | declarations if we didn't have a lookup map when the external decls were added. llvm-svn: 174906
* Use static functions instead of an unnamed namespaceDmitri Gribenko2013-02-101-6/+8
| | | | llvm-svn: 174835
* Comment parsing: use CharInfo.hDmitri Gribenko2013-02-092-43/+17
| | | | | | | This also gives us 0.2% speedup on '-fsyntax-only -Wdocumentation' time for a testcase that consists of all Clang headers. llvm-svn: 174810
* Ensure that type definitions present in just-loaded modules areDouglas Gregor2013-02-095-18/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | visible. The basic problem here is that a given translation unit can use forward declarations to form pointers to a given type, say, class X; X *x; and then import a module that includes a definition of X: import XDef; We will then fail when attempting to access a member of X, e.g., x->method() because the AST reader did not know to look for a default of a class named X within the new module. This implementation is a bit of a C-centric hack, because the only definitions that can have this property are enums, structs, unions, Objective-C classes, and Objective-C protocols, and all of those are either visible at the top-level or can't be defined later. Hence, we can use the out-of-date-ness of the name and the identifier-update mechanism to force the update. In C++, we will not be so lucky, and will need a more advanced solution, because the definitions could be in namespaces defined in two different modules, e.g., // module 1 namespace N { struct X; } // module 2 namespace N { struct X { /* ... */ }; } One possible implementation here is for C++ to extend the information associated with each identifier table to include the declaration IDs of any definitions associated with that name, regardless of context. We would have to eagerly load those definitions. llvm-svn: 174794
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-083-5/+6
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* StmtPrinter: Write large char values using \u or \U.Jordan Rose2013-02-081-8/+9
| | | | | | | | | This may not always be valid, but we were previously just emitting them raw. While here, s/isprint/isPrintable/ (using the new CharInfo). llvm-svn: 174766
* Use the target address space value when mangling names.Tanya Lattner2013-02-081-1/+2
| | | | llvm-svn: 174688
* Fix stack overflow and improve performance when a module contains manyRichard Smith2013-02-081-5/+7
| | | | | | | | | | | | | overloads of a name by claiming that there are no lookup results for that name in modules while loading the names from the module. Lookups in deserialization really don't want to find names which they themselves are in the process of introducing. This also has the pleasant side-effect of automatically caching PCH lookups which found no names. The runtime here is still quadratic in the number of overloads, but the constant is lower. llvm-svn: 174685
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-076-0/+12
| | | | | | restrictions. llvm-svn: 174601
* Fix handling of module imports adding names to a DeclContext after qualifiedRichard Smith2013-02-071-10/+37
| | | | | | | | | | | | | | | | name lookup has been performed in that context (this probably only happens in C++). 1) Whenever we add names to a context, set a flag on it, and if we perform lookup and discover that the context has had a lookup table built but has the flag set, update all entries in the lookup table with additional names from the external source. 2) When marking a DeclContext as having external visible decls, mark the context in which lookup is performed, not the one we are adding. These won't be the same if we're adding another copy of a pre-existing namespace. llvm-svn: 174577
* Simplify FindExternalVisibleDeclsByName by making it return a bool indicatingRichard Smith2013-02-072-3/+11
| | | | | | | | | | | | if it found any decls, rather than returning a list of found decls. This removes a returning-ArrayRef-to-deleted-storage bug from MultiplexExternalSemaSource (in code not exercised by any of the clang binaries), reduces the work required in the found-no-decls case with PCH, and importantly removes the need for DeclContext::lookup to be reentrant. No functionality change intended! llvm-svn: 174576
* AST dumping: indicate the previous declaration for a redeclaration, andRichard Smith2013-02-071-1/+27
| | | | | | | indicate the semantic DC if it's not the lexical DC. In passing, correct the ascii-art child marker for a child of a FriendDecl. llvm-svn: 174570
* DeclPrinter: fix CXXConstructExpr printing with implicit default argumentDmitri Gribenko2013-02-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This is an improvement of r173630, that handles the following case: struct VirualDestrClass { VirualDestrClass(int arg); virtual ~VirualDestrClass(); }; struct ConstrWithCleanupsClass { ConstrWithCleanupsClass(const VirualDestrClass& cplx = VirualDestrClass(42)); }; ConstrWithCleanupsClass cwcNoArg; That was printed as: ConstrWithCleanupsClass cwcNoArg(); llvm-svn: 174296
* CodeGen: Remove unnecessary const_casts. No functionality change.Benjamin Kramer2013-02-031-7/+3
| | | | llvm-svn: 174292
* Remove unneeded const_castsDmitri Gribenko2013-02-031-4/+2
| | | | llvm-svn: 174287
OpenPOWER on IntegriCloud