summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* AST: Cleanup __uuidof related codeDavid Majnemer2014-07-141-9/+8
| | | | | | | | Switch some things to use range-based for loops. Change CXXUuidofExpr::GetUuidAttrOfType's return type to be const. No functionality changed. llvm-svn: 213009
* [OPENMP] Parsing and sema analysis for 'omp task' directive.Alexey Bataev2014-07-113-0/+35
| | | | llvm-svn: 212804
* Add AST dumping for VarDecl init kind.Richard Smith2014-07-101-0/+5
| | | | llvm-svn: 212774
* Cleanup. No functionality change.Richard Smith2014-07-101-2/+2
| | | | llvm-svn: 212667
* [OPENMP] Parsing and sema analysis for 'omp parallel sections' directive.Alexey Bataev2014-07-083-0/+35
| | | | llvm-svn: 212516
* ASTContext: Factor 'getObjCEncodingForPropertyType' as its own method.Joe Groff2014-07-071-3/+11
| | | | | | | It is useful to get the property encoding for an ObjC type without a full ObjCPropertyDecl. llvm-svn: 212496
* Handle __builtin_clzs and __builtin_ctzs in the constant expression evaluator.Anders Carlsson2014-07-071-2/+4
| | | | llvm-svn: 212464
* [OPENMP] Added initial support for 'omp parallel for'.Alexey Bataev2014-07-073-0/+36
| | | | llvm-svn: 212453
* Fix an iterator invalidation issue: deserializing a key function can write toRichard Smith2014-07-071-7/+18
| | | | | | | the key functions table. Don't hold references to anything within that table across such an access. llvm-svn: 212437
* Add an explicit diagnostic for the case where an expression is not a constantRichard Smith2014-07-071-2/+7
| | | | | | expression because it uses 'this'. Inspired by PR20219 comment#2. llvm-svn: 212433
* Add an AST node for __leave statements, hook it up.Nico Weber2014-07-072-0/+9
| | | | | | | Codegen is still missing (and I won't work on that), but __leave is now as implemented as __try and friends. llvm-svn: 212425
* Fix linkage bug that miscompiled variable templates instantiated from ↵Larisse Voufo2014-07-021-0/+64
| | | | | | | | | | | similarly named local types. In essence, this bug ensures that the x<Foo> specialization in function foo() defined as follows differs between two distinct translation units. static int &foo() { struct Foo { }; return x<Foo>; } llvm-svn: 212233
* Make FunctionDecl::getReturnTypeSourceRange() support non-builtin typesAlp Toker2014-07-021-8/+11
| | | | | | | Also document that the function is a "best-effort" facility to extract source ranges from limited AST type location info. llvm-svn: 212174
* Introduce a FunctionDecl::getReturnTypeSourceRange() utilityAlp Toker2014-07-021-0/+17
| | | | | | | | | | This source range is useful for all kinds of diagnostic QOI and refactoring work, so let's make it more discoverable. This commit also makes use of the new function to enhance various diagnostics relating to return types and resolves an old FIXME. llvm-svn: 212154
* Driver: Handle /GR- in a compatible way with MSVCDavid Majnemer2014-07-011-1/+1
| | | | | | | | | | | | | | | | | There are slight differences between /GR- and -fno-rtti which made mapping one to the other inappropriate. -fno-rtti disables dynamic_cast, typeid, and does not emit RTTI related information for the v-table. /GR- does not generate complete object locators and thus will not reference them in vftables. However, constructs like dynamic_cast and typeid are permitted. This should bring our implementation of RTTI up to semantic parity with MSVC modulo bugs. llvm-svn: 212138
* AST: Small simplification in VTableBuilderDavid Majnemer2014-07-011-4/+8
| | | | | | | Stash whether or not we have an RTTI component away instead of recomputing it. llvm-svn: 212127
* MS ABI: Reference MSVC RTTI from the VFTableDavid Majnemer2014-07-011-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pointer for a class's RTTI data comes right before the VFTable but has no name. To be properly compatible with this, we do the following: * Create a single GlobalVariable which holds the contents of the VFTable _and_ the pointer to the RTTI data. * Create a GlobalAlias, with appropriate linkage/visibility, that points just after the RTTI data pointer. This ensures that the VFTable symbol will always refer to VFTable data. * Create a Comdat with a "Largest" SelectionKind and stick the private GlobalVariable in it. By transitivity, the GlobalAlias will be a member of the Comdat group. Using "Largest" ensures that foreign definitions without an RTTI data pointer will _not_ be chosen in the final linked image. Whether or not we emit RTTI data depends on several things: * The -fno-rtti flag implies that we should never not emit a pointer to RTTI data before the VFTable. * __declspec(dllimport) brings in the VFTable from a remote DLL. Use an available_externally GlobalVariable to provide a local definition of the VFTable. This means that we won't have any available_externally definitions of things like complete object locators. This is acceptable because they are never directly referenced. To my knowledge, this completes the implementation of MSVC RTTI code generation. Further semantic work should be done to properly support /GR-. llvm-svn: 212125
* PR15677 - Crash in template diffing. Check that expression is evaluatable ↵Nikola Smiljanic2014-07-011-17/+29
| | | | | | before evaluating it. llvm-svn: 212090
* Import MutableArrayRef into clang namespace.Craig Topper2014-06-282-4/+4
| | | | llvm-svn: 211988
* Remove llvm:: from uses of ArrayRef.Craig Topper2014-06-283-5/+4
| | | | llvm-svn: 211987
* [OPENMP] Parsing and sema analysis for 'copyprivate' clause.Alexey Bataev2014-06-273-0/+34
| | | | llvm-svn: 211886
* Avoid extra back reference key lookup in msmanglerReid Kleckner2014-06-261-19/+17
| | | | | | | | | | | | | | | Avoid a second key lookup when the back reference key is going to be inserted in the StringMap. The string lookups in the msmangler are the main responsible for the huge overhead when compared to the itanium mangler. This patch makes a small but noticeable improvement. Reviewed by: rnk Differential Revision: http://reviews.llvm.org/D4130 Patch by Agustín Bergé! llvm-svn: 211813
* [OPENMP] Initial parsing and sema analysis for 'single' directive.Alexey Bataev2014-06-263-0/+35
| | | | llvm-svn: 211774
* [OPENMP] Initial parsing and sema analysis for 'section' directive.Alexey Bataev2014-06-263-0/+29
| | | | llvm-svn: 211767
* Convert some function arguments to use ArrayRef.Craig Topper2014-06-262-22/+18
| | | | llvm-svn: 211764
* Convert StringLiteralParser constructor to use ArrayRef instead of a pointer ↵Craig Topper2014-06-261-1/+1
| | | | | | and count. llvm-svn: 211763
* Don't allow dllimport variables in constant initializersHans Wennborg2014-06-251-10/+3
| | | | | | | | | | | | | | | | | This is a follow-up to David's r211677. For the following code, we would end up referring to 'foo' in the initializer for 'arr', and then fail to link, because 'foo' is dllimport and needs to be accessed through the __imp_?foo. __declspec(dllimport) extern const char foo[]; const char* f() { static const char* const arr[] = { foo }; return arr[0]; } Differential Revision: http://reviews.llvm.org/D4299 llvm-svn: 211736
* Fix treatment of types defined in function prototypeSerge Pavlov2014-06-251-0/+12
| | | | | | | | | | | | Types defined in function prototype are diagnosed earlier in C++ compilation. They are put into declaration context where the prototype is introduced. Later on, when FunctionDecl object is created, these types are moved into the function context. This patch fixes PR19018 and PR18963. Differential Revision: http://reviews.llvm.org/D4145 llvm-svn: 211718
* [OPENMP] Initial support for 'sections' directive.Alexey Bataev2014-06-253-0/+33
| | | | llvm-svn: 211685
* AST: Initialization with dllimport functions in CDavid Majnemer2014-06-251-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C++ language requires that the address of a function be the same across all translation units. To make __declspec(dllimport) useful, this means that a dllimported function must also obey this rule. MSVC implements this by dynamically querying the import address table located in the linked executable. This means that the address of such a function in C++ is not constant (which violates other rules). However, the C language has no notion of ODR nor does it permit dynamic initialization whatsoever. This requires implementations to _not_ dynamically query the import address table and instead utilize a wrapper function that will be synthesized by the linker which will eventually query the import address table. The effect this has is, to say the least, perplexing. Consider the following C program: __declspec(dllimport) void f(void); typedef void (*fp)(void); static const fp var = &f; const fp fun() { return &f; } int main() { return fun() == var; } MSVC will statically initialize "var" with the address of the wrapper function and "fun" returns the address of the actual imported function. This means that "main" will return false! Note that LLVM's optimizers are strong enough to figure out that "main" should return true. However, this result is dependent on having optimizations enabled! N.B. This change also permits the usage of dllimport declarators inside of template arguments; they are sufficiently constant for such a purpose. Add tests to make sure we don't regress here. llvm-svn: 211677
* [OPENMP] OMPSimdDirective and OMPForDirective: added initialization for ↵Alexey Bataev2014-06-251-17/+15
| | | | | | CollapsedNum member. llvm-svn: 211672
* Don't go through the TypeSourceInfo when getting the SourceRange.Zachary Turner2014-06-251-3/+3
| | | | | | | | | | | | VarDecl provides a method getSourceRange(), which provides a more robust way of getting the SourceRange since the TypeSourceInfo can be null in certain cases. Reviewed by: majnemer Differential Revision: http://reviews.llvm.org/D4281 llvm-svn: 211667
* AST: Address of dllimport functions isn't constantDavid Majnemer2014-06-241-1/+4
| | | | | | | | | | | | | | | | The address of dllimport functions can be accessed one of two ways: - Through the IAT which is symbolically referred to with a symbol starting with __imp_. - Via the wrapper-function which ends up calling through the __imp_ symbol. The problem with using the wrapper-function is that it's address will not compare as equal in all translation units. Specifically, it will compare unequally with the translation unit which defines the function. This fixes PR19955. llvm-svn: 211570
* AST: Address of dllimport variables isn't constantDavid Majnemer2014-06-241-0/+3
| | | | | | | | | | | | | The address of dllimport variables isn't something that can be meaningfully used in a constexpr context and isn't suitable for evaluation at load-time. They require loads from memory to properly evaluate. This fixes PR19955. Differential Revision: http://reviews.llvm.org/D4250 llvm-svn: 211568
* Lex: Use the correct types for MS integer suffixesDavid Majnemer2014-06-211-5/+4
| | | | | | | | | | | | | | | | Something went wrong with r211426, it is an older version of this code and should not have been committed. It was reverted with r211434. Original commit message: We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 llvm-svn: 211441
* Revert "Lex: Use the correct types for MS integer suffixes"Rafael Espindola2014-06-211-4/+2
| | | | | | | | | This reverts commit r211426. This broke the arm bots. The crash can be reproduced on X86 by running. ./bin/clang -cc1 -fsyntax-only -verify -fms-extensions ~/llvm/clang/test/Lexer/ms-extensions.c -triple arm-linux llvm-svn: 211434
* Lex: Use the correct types for MS integer suffixesDavid Majnemer2014-06-211-2/+4
| | | | | | | | | | | | We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 llvm-svn: 211426
* Fix crash caused by unnamed union or struct when doing ast-printSerge Pavlov2014-06-201-3/+5
| | | | llvm-svn: 211380
* [OPENMP] Initial support for 'nowait' clause.Alexey Bataev2014-06-202-0/+6
| | | | llvm-svn: 211352
* [OPENMP] Initial support for 'ordered' clause.Alexey Bataev2014-06-202-0/+6
| | | | llvm-svn: 211347
* [OPENMP] Initial support for 'schedule' clause.Alexey Bataev2014-06-202-0/+15
| | | | llvm-svn: 211342
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-181-2/+2
| | | | llvm-svn: 211143
* [OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with ↵Alexey Bataev2014-06-183-0/+36
| | | | | | MSVC). llvm-svn: 211140
* Revert "[OPENMP] Initial support for '#pragma omp for'."Rafael Espindola2014-06-173-36/+0
| | | | | | | | This reverts commit r211096. Looks like it broke the msvc build: SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template llvm-svn: 211113
* [OPENMP] Initial support for '#pragma omp for'.Alexey Bataev2014-06-173-0/+36
| | | | llvm-svn: 211096
* [OPENMP] Initial support of 'reduction' clauseAlexey Bataev2014-06-163-0/+50
| | | | llvm-svn: 211007
* Adds a Pragma spelling for attributes to tablegen and makes use of it for loopTyler Nowicki2014-06-131-14/+2
| | | | | | | | | hint attributes. Includes tests for pragma printing and for attribute order which is incorrectly reversed by ParsedAttributes. Reviewed by Aaron Ballman llvm-svn: 210925
* Do not store duplicate parents when memoization data is available.Samuel Benzaquen2014-06-131-14/+25
| | | | | | | | | | | | | | Summary: Do not store duplicate parents when memoization data is available. This does not solve the duplication problem, but ameliorates it. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D4124 llvm-svn: 210902
* MS ABI: Fix inheritance model calculation in CRTPDavid Majnemer2014-06-132-3/+8
| | | | | | | | | | | | | | | | | CRTP-like patterns involve a class which inherits from another class using itself as a template parameter. However, the base class itself may try to create a pointer-to-member which involves the derived class. This is problematic because we may not have finished parsing the most derived classes' base specifiers yet. It turns out that MSVC simply uses the unspecified inheritance model instead of doing anything fancy. This fixes PR19987. llvm-svn: 210886
* Extend AST dump to include 'used' and 'referenced' flags, and put 'invalid' ↵Richard Smith2014-06-131-3/+6
| | | | | | flag in the right place. llvm-svn: 210872
OpenPOWER on IntegriCloud