summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the representation of builtin functions in the ASTEli Friedman2012-08-312-0/+7
| | | | | | | | | (__builtin_* etc.) so that it isn't possible to take their address. Specifically, introduce a new type to represent a reference to a builtin function, and a new cast kind to convert it to a function pointer in the operand of a call. Fixes PR13195. llvm-svn: 162962
* Keep history of macro definitions and #undefsAlexander Kornienko2012-08-291-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Summary: Keep history of macro definitions and #undefs with corresponding source locations, so that we can later find out all macros active in a specified source location. We don't save the history in PCH (no need currently). Memory overhead is about sizeof(void*)*3*<number of macro definitions and #undefs>+<in-memory size of all #undef'd macros> I've run a test on a file composed of 109 .h files from boost 1.49 on x86-64 linux. Stats before this patch: *** Preprocessor Stats: 73222 directives found: 19171 #define. 4345 #undef. #include/#include_next/#import: 5233 source files entered. 27 max include stack depth 19210 #if/#ifndef/#ifdef. 2384 #else/#elif. 6891 #endif. 408 #pragma. 14466 #if/#ifndef#ifdef regions skipped 80023/451669/1270 obj/fn/builtin macros expanded, 85724 on the fast path. 127145 token paste (##) operations performed, 11008 on the fast path. Preprocessor Memory: 5874615B total BumpPtr: 4399104 Macro Expanded Tokens: 417768 Predefines Buffer: 8135 Macros: 1048576 #pragma push_macro Info: 0 Poison Reasons: 1024 Comment Handlers: 8 Stats with this patch: ... Preprocessor Memory: 7541687B total BumpPtr: 6066176 Macro Expanded Tokens: 417768 Predefines Buffer: 8135 Macros: 1048576 #pragma push_macro Info: 0 Poison Reasons: 1024 Comment Handlers: 8 In my test increase in memory usage is about 1.7Mb, which is ~28% of initial preprocessor's memory usage and about 0.8% of clang's total VMM allocation. As for CPU overhead, it should only be noticeable when iterating over all macros, and should mostly consist of couple extra dereferences and one comparison per macro + skipping of #undef'd macros. It's less trivial to measure, though, as the preprocessor consumes a very small fraction of compilation time. Reviewers: doug.gregor, klimek, rsmith, djasper Reviewed By: doug.gregor CC: cfe-commits, chandlerc Differential Revision: http://llvm-reviews.chandlerc.com/D28 llvm-svn: 162810
* [ms-inline asm] Rename getClobber to getClobberStringLiteral. No functionalChad Rosier2012-08-271-1/+1
| | | | | | change intended. llvm-svn: 162710
* [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.Chad Rosier2012-08-253-6/+6
| | | | | | No functional change intended. llvm-svn: 162632
* [ms-inline asm] Update the AST Reader/Writer for MS-style inline asms.Chad Rosier2012-08-243-0/+7
| | | | llvm-svn: 162629
* Fix a few -Wdocumentation warnings.Dmitri Gribenko2012-08-241-2/+0
| | | | llvm-svn: 162506
* Reduce duplicated hash map lookups.Benjamin Kramer2012-08-222-7/+3
| | | | llvm-svn: 162361
* [ms-inline asm] Remove old cruft now that MS-style asms their own code path.Chad Rosier2012-08-202-2/+0
| | | | llvm-svn: 162210
* Remove trailing return flag from FunctionTypeLoc, since we now carry thatRichard Smith2012-08-142-2/+0
| | | | | | | information on FunctionProtoType. (This also fixes one of *many* misalignment problems in the TypeLoc hierarchy...) llvm-svn: 161901
* clang/lib: [CMake] Update tblgen'd dependencies.NAKAMURA Takumi2012-07-271-0/+2
| | | | llvm-svn: 160851
* clang/lib: [CMake] Reformat, alphabetize lists.NAKAMURA Takumi2012-07-271-2/+2
| | | | llvm-svn: 160850
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-272-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* Remove HasSynthBitfield and all callers/writers/etc. Also removeEric Christopher2012-07-192-4/+0
| | | | | | | | previous ResetObjCLayout calls since this is now handled in Sema. Part of rdar://11842763 llvm-svn: 160527
* Stop instantiating a class if we hit a static_assert failure. Also, if theRichard Smith2012-07-112-1/+3
| | | | | | | static_assert fails when parsing the template, don't diagnose it again on every instantiation. llvm-svn: 160088
* Introduce a flag in SourceManager to treat non-system source filesArgyrios Kyrtzidis2012-07-111-3/+5
| | | | | | | | | | | | | | | | | | | | as "volatile", meaning there's a high enough chance that they may change while we are trying to use them. This flag is only enabled by libclang. Currently "volatile" source files will be stat'ed immediately before opening them, because the file size stat info may not be accurate since when we got it (e.g. from the PCH). This avoids crashes when trying to reference mmap'ed memory from a file whose size is not what we expect. Note that there's still a window for a racing issue to occur but the window for it should be way smaller than before. We can consider later on to avoid mmap completely on such files. rdar://11612916 llvm-svn: 160074
* Silence unused variable warning in -Asserts buildMatt Beaumont-Gay2012-07-091-0/+1
| | | | llvm-svn: 159954
* Inline storage of attributes in AttributedStmt.Alexander Kornienko2012-07-094-6/+15
| | | | llvm-svn: 159925
* Don't store pointers into a std::vector (RawCommentList::Comments). AlthoughDmitri Gribenko2012-07-062-10/+11
| | | | | | | | currently we take address of std::vector's contents only after we finished adding all comments (so no reallocation can happen), this will change in future. llvm-svn: 159845
* Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko2012-07-061-0/+1
| | | | | | | | | | | | | | very simple semantic analysis that just builds the AST; minor changes for lexer to pick up source locations I didn't think about before. Comments AST is modelled along the ideas of HTML AST: block and inline content. * Block content is a paragraph or a command that has a paragraph as an argument or verbatim command. * Inline content is placed within some block. Inline content includes plain text, inline commands and HTML as tag soup. llvm-svn: 159790
* Drop the ASTContext.h include from DeclFriend.h and DeclTemplate.h.Benjamin Kramer2012-07-042-0/+2
| | | | llvm-svn: 159723
* [PCH] Make sure that all newly introduced visible decls in a DeclContextArgyrios Kyrtzidis2012-07-022-2/+26
| | | | | | | | | | | | | | | | | coming from an AST file are registered for serialization. A static data member instantiation of in a chained PCH could be missed when serializing decls; the result was that when emitting the visible decls map of its DeclContext, we would use a DeclID that was not actually emitted, leading to crashes or hangs. Fix this by making sure such decls are always registered for serialization. Also introduce extra sanity checks to make sure we don't register new declarations or types after we have serialized the types/decls block. rdar://11728990 llvm-svn: 159550
* PR13189: va_list broken with precompiled headersMeador Inge2012-07-012-0/+5
| | | | | | | | | | For some targets a structure named __va_list_tag is built to help define the __builtin_va_list type. However, __va_list_tag was not being treated as a predefined type thus causing problems when serializing the AST. This commit fixes that oversight by adding the necessary support to treat __va_list_tag as a predefined type. llvm-svn: 159508
* Remove a goofy CMake hack and use the standard CMake facilities toChandler Carruth2012-06-211-3/+6
| | | | | | | | | express library-level dependencies within Clang. This is no more verbose really, and plays nicer with the rest of the CMake facilities. It should also have no change in functionality. llvm-svn: 158888
* Fix a warning on a fully covered switch with a default:Chandler Carruth2012-06-201-13/+10
| | | | | | | | ../tools/clang/lib/Serialization/ASTReader.cpp:6316:9: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default] Also fix the indentation here to match the coding conventions. llvm-svn: 158794
* Restructure how the driver communicates information about theJohn McCall2012-06-202-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Add the PCH file name to the message about not being able to read the PCH.Kaelyn Uhrain2012-06-201-1/+1
| | | | | | | | Also add a couple of unit tests to check the invalid-PCH error messages to satisfy PR4568 and for the assertion (introduced in r149918 and fixed in r158769) that would cause clang to crash when given an empty PCH. llvm-svn: 158772
* Structured comment parsing, first step.Dmitri Gribenko2012-06-202-0/+84
| | | | | | | | | * 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-162-7/+6
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* [AST/libclang] Fix the selector locations that are reported for aArgyrios Kyrtzidis2012-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | method definition that has its '{' attached to the method name without a space. With a method like: -(id)meth{ ..... } the logic in ObjCMethodDecl that determined the selector locations got confused because it was initialized based on an end location for '{' but that end location changed to '}' after the method was finished. Fix this by having an immutable end location for the declarator and for getLocEnd() get the end location from the body itself. Fixes rdar://11659739. llvm-svn: 158583
* Etch out the code path for MS-style inline assembly.Chad Rosier2012-06-112-0/+10
| | | | llvm-svn: 158325
* Remove CXXRecordDecl flags which are unused after r158289.Richard Smith2012-06-102-8/+0
| | | | | | | | | | | | | | | | | | | | | We need an efficient mechanism to determine whether a defaulted default constructor is constexpr, in order to determine whether a class is a literal type, so keep the incrementally-built form on CXXRecordDecl. Remove the on-demand computation of same, so that we only have one method for determining whether a default constructor is constexpr. This doesn't affect correctness, since default constructor lookup is much simpler than selecting a constructor for copying or moving. We don't need a corresponding mechanism for defaulted copy or move constructors, since they can't affect whether a type is a literal type. Conversely, checking whether such functions are constexpr can require non-trivial effort, so we defer such checks until the copy or move constructor is required. Thus we now only compute whether a copy or move constructor is constexpr on demand, and only compute whether a default constructor is constexpr in advance. This is unfortunate, but seems like the best solution. llvm-svn: 158290
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-102-11/+12
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* Switch LineTableInfo to use FileID instead of int for file references,Douglas Gregor2012-06-082-3/+3
| | | | | | from Tom Honermann! llvm-svn: 158211
* Plug a long standing memory leak in TemplateArgument.Benjamin Kramer2012-06-072-2/+2
| | | | | | | | | | | | | | | The integral APSInt value is now stored in a decomposed form and the backing store for large values is allocated via the ASTContext. This way its not leaked as TemplateArguments are never destructed when they are allocated in the ASTContext. Since the integral data is immutable it is now shared between instances, making copying TemplateArguments a trivial operation. Currently getting the integral data out of a TemplateArgument requires creating a new APSInt object. This is cheap when the value is small but can be expensive if it's not. If this turns out to be an issue a more efficient accessor could be added. llvm-svn: 158150
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-1/+1
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Remove unused private member variables found by clang's new ↵Benjamin Kramer2012-06-062-8/+4
| | | | | | -Wunused-private-field. llvm-svn: 158086
* Address minor FIXME in RedeclLink to contain a PointerIntPair instead of ↵David Blaikie2012-05-281-11/+10
| | | | | | | | derive from it. Use actual factory functions rather than derived classes acting as named constructors/factories. llvm-svn: 157588
* Fix ASTReader handling of ImportDecls, from Meador Inge!Douglas Gregor2012-05-161-1/+0
| | | | llvm-svn: 156923
* [libclang/AST] Index references of protocols in "@protocol(...)" syntax.Argyrios Kyrtzidis2012-05-162-0/+2
| | | | | | | | | To do that, keep track of the location of the protocol id in the ObjCProtocolExpr AST node. rdar://11190837 llvm-svn: 156890
* [AST/libclang] Speed up clang_getOverriddenCursors() considerably by ↵Argyrios Kyrtzidis2012-05-092-0/+2
| | | | | | | | | | | | | reserving a bit in ObjCMethodDecl to indicate whether the method does not override any other method, which is the majority of cases. That way we can avoid unnecessary work doing lookups, especially when PCH is involved. rdar://11360082 llvm-svn: 156476
* A union can have a constexpr defaulted default constructor, if it has anRichard Smith2012-05-072-0/+2
| | | | | | | | | in-class initializer for one of its fields. Value-initialization of such a type should use the in-class initializer! The former was just a bug, the latter is a (reported) standard defect. llvm-svn: 156274
* [PCH] Use DenseMap instead of std::map to keep track of SwitchCases.Argyrios Kyrtzidis2012-05-041-2/+2
| | | | | | Part of rdar://11353109. llvm-svn: 156185
* [PCH] Really, pinky swear, fix for PR12689Argyrios Kyrtzidis2012-05-042-8/+13
| | | | | | rdar://11353109 llvm-svn: 156145
* Fix non-deterministic iteration order when walking the specializationsChandler Carruth2012-05-031-3/+4
| | | | | | | | | | | | | of templates by using the newly introduce FoldingSetVector. This preserves insertion order for all iteration of specializations. I've also included a somewhat terrifying testcase that rapidly builds up a large number of functions. This is enough that any system with ASLR will have non-deterministic debug information generated for the test case without the fix here as the debug information is generated in part by walking these specializations. llvm-svn: 156133
* [PCH] When validating that the files coming from PCH did not change, alsoArgyrios Kyrtzidis2012-05-031-2/+22
| | | | | | | | | | | validate that we didn't override the contents of any of such files. If this is detected, emit a diagnostic error and recover gracefully by using the contents of the original file that the PCH was built from. Part of rdar://11305263 llvm-svn: 156107
* [PCH] Clear switch case IDs when deserializing a objc method body.Argyrios Kyrtzidis2012-05-031-0/+2
| | | | | | Fixes rdar://11353109 & http://llvm.org/bugs/show_bug.cgi?id=12689 llvm-svn: 156056
* Store the source range of a CXXOperatorCallExpr in the Expr object instead ofArgyrios Kyrtzidis2012-04-302-1/+3
| | | | | | | | | | | | | | | calculating it recursively. boost::assign::tuple_list_of uses the trick of chaining call operator expressions in order to declare a "list of tuples", e.g: std::vector<tuple> v = boost::assign::tuple_list_of(1, "foo")(2, "bar")(3, "qqq"); Due to CXXOperatorCallExpr calculating its source range recursively we would get significant slowdowns with a large number of chained call operator expressions and the potential for stack overflow. rdar://11350116 llvm-svn: 155848
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-1/+1
| | | | | | | | | | | | | 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
* [PCH] In ASTReader::completeVisibleDeclsMap, after we loaded all visible ↵Argyrios Kyrtzidis2012-04-261-0/+1
| | | | | | | | | | | decls, mark the declaration context as not having external visible storage any more. This should improve performance as we won't needlessly reload the visible decls multiple times and seems to fix the i386 crash in rdar://11327522. llvm-svn: 155649
* Fix serialization of uninstantiated exception specifications. Patch by Li Kan,Richard Smith2012-04-212-0/+6
| | | | | | test by me. llvm-svn: 155289
OpenPOWER on IntegriCloud