summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Prevent premature macro expansion in __has_builtin, __has_feature,Andy Gibbs2012-11-171-3/+3
| | | | | | | __has_attribute, __has_extension, making them behave more akin to conventional macros. llvm-svn: 168268
* Made the "expected string literal" diagnostic more expressiveAndy Gibbs2012-11-176-8/+18
| | | | llvm-svn: 168267
* Refactored duplicate string literal lexing code within Preprocessor, into aAndy Gibbs2012-11-173-148/+86
| | | | | | | | | | | | | common LexStringLiteral function. In doing so, some consistency problems have been ironed out (e.g. where the first token in the string literal was lexed with macro expansion, but subsequent ones were not) and also an erroneous diagnostic has been corrected. LexStringLiteral is complemented by a FinishLexStringLiteral function which can be used in the situation where the first token of the string literal has already been lexed. llvm-svn: 168266
* Fix handling of invalid uses of the __has_warning builtin macroAndy Gibbs2012-11-171-2/+6
| | | | llvm-svn: 168265
* Enable inlining of 4 byte atomic ops on ppc32, 8 byte atomic ops on ppc64.Benjamin Kramer2012-11-172-6/+10
| | | | | | Also fixes a bit/byte mismatch when checking if a target supports atomic ops of a certain size. llvm-svn: 168260
* Further reduce "-fsyntax-only -Wuninitialized" time on sqlite3.c by another ↵Ted Kremenek2012-11-171-12/+52
| | | | | | 2.5% using intelligent pruning of blocks during the final reporting pass. llvm-svn: 168257
* Switch -Wuninitialized to use a reverse-post order traversal asTed Kremenek2012-11-171-15/+33
| | | | | | | | | an initial baseline for enqueued blocks, but use a simple DFS stack for propagating changes quickly up back edges. This provides a 3.5% reduction in -fsyntax-only time on sqlite3.c. llvm-svn: 168241
* Add missing features for misc x86 CPUs to CPU feature translation. Patch by ↵Eli Friedman2012-11-171-1/+14
| | | | | | Jung-uk Kim. llvm-svn: 168239
* Clean up X86 target feature translation code slightly. No intended ↵Eli Friedman2012-11-171-14/+3
| | | | | | functional change. Patch by Jung-uk Kim. llvm-svn: 168237
* Revert r167799. It's not really correct, and it doesn't fix the problem that ↵Bill Wendling2012-11-161-16/+9
| | | | | | it was intended to fix. llvm-svn: 168217
* [driver] Add the missing TY_PP_ObjCXX_Alias case to the isCXX function.Chad Rosier2012-11-161-1/+1
| | | | | | | | | This was causing different behavior when using -x objective-c++-cpp-output as compared to -x objc++-cpp-output. Specifically, the driver was not adding the -fcxx-exceptions flag in the latter case. rdar://12680312 llvm-svn: 168212
* StmtDumper: remove incomplete support for limiting the maximum dump depth.Dmitri Gribenko2012-11-161-33/+5
| | | | | | | | | There are better ways of limiting the amount of information if there is a need for that. Patch by Philip Craig. llvm-svn: 168206
* Fix partial-match-bind-behavior with forEachDescendant() matchers.Daniel Jasper2012-11-161-2/+5
| | | | | | | | | | | | | | | | The problem is that a partial match of an (explicit or implicit) allOf matcher binds results, i.e. recordDecl(decl().bind("x"), hasName("A")) can very well bind a record that is not named "A". With this fix, the common cases of stumbling over this bug are fixed by the BoundNodesMap overwriting the results of a partial match. An error can still be created with a weird combination of anyOf and allOf (see inactive test). We need to decide whether this is worth fixing, as the fix will have performance impact. Review: http://llvm-reviews.chandlerc.com/D124 llvm-svn: 168177
* Make libASTMatchers link its dependencies. libRewriteFrontend depends on ↵Benjamin Kramer2012-11-162-1/+6
| | | | | | | | libRewriteCore. LLVM_USED_LIBS does nothing here. llvm-svn: 168172
* UBSan: enable proper linking with UBsan runtime on Darwin. Turn on building ↵Alexey Samsonov2012-11-162-6/+24
| | | | | | ubsan on OS X in 'make' build system. Patch by Jean-Daniel Dupas. llvm-svn: 168168
* Store this Decl* as a Decl* instead of a uintptr_t. No functionality change.Nick Lewycky2012-11-162-23/+21
| | | | llvm-svn: 168145
* Since CreateTargetInfo is taking ownership of the target options, passDouglas Gregor2012-11-164-23/+23
| | | | | | it as a pointer. llvm-svn: 168136
* [libclang] When caching code-completion results, pass the ↵Argyrios Kyrtzidis2012-11-161-4/+5
| | | | | | | | | | | | | | CachedCompletionAllocator to the CodeCompletionTUInfo that is going to be used to get the results. Previously we would use ASTUnit's CodeCompletionTUInfo which has its own allocator that will go away when we reparse. That could result in a use-after-free bug when getting the parent context name from a CodeCompletionString. Addresses rdar://12568377. llvm-svn: 168133
* CPP Output: Do not emit an enter file marker for the main file.Daniel Dunbar2012-11-161-0/+11
| | | | | | | | - This diverges from gcc, and confuses tools (like dtrace) which track # line markers as a way to determine which content is in the context of the main file. llvm-svn: 168128
* Take into account the zero sign bit for positive numbers when computing the bitRichard Trieu2012-11-161-1/+5
| | | | | | | width of an enum with negative values in IntRange. Include a test for -Wtautological-constant-out-of-range-compare where this had manifested. llvm-svn: 168126
* Fix PR14321, a crash when Clang is built with GCC 4.7 at -O1 or greater.Matt Beaumont-Gay2012-11-161-1/+1
| | | | | | | | | GCC 4.7 reuses stack slots fairly aggressively, which exposes more temporary lifetime bugs. No new test, this was caught by the existing CodeGenCXX/mangle-ms-templates.cpp. llvm-svn: 168124
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-169-49/+49
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* Make sure CodeGenTypes correctly reconverts function types. Fixes PR14355, ↵Eli Friedman2012-11-151-1/+11
| | | | | | a crash in IR generation. llvm-svn: 168112
* PR9903: Recover from a member functon declared with the 'typedef' specifier byRichard Smith2012-11-151-9/+2
| | | | | | | dropping the specifier, just like we do for non-member functions and function templates declared 'typedef'. Patch by Brian Brooks! llvm-svn: 168108
* [analyzer] Fix a use-after-free introduced in r168019.Jordan Rose2012-11-151-4/+5
| | | | | | | | | | | | | | | | | | | | | | | In code like this: void foo() { bar(); baz(); } ...the location for the call to 'bar()' was being used as a backup location for the call to 'baz()'. This is fine unless the call to 'bar()' is deemed uninteresting and that part of the path deleted. (This looks like a logic error as well, but in practice the only way 'baz()' could have an invalid location is if the entire body of 'foo()' is synthesized, meaning the call to 'bar()' will be using the location of the call to 'foo()' anyway. Nevertheless, the new version better matches the intent of the code.) Found by Matt Beaumont-Gay using ASan. Thanks, Matt! llvm-svn: 168080
* If an excluded header does not exist, just ignore itDouglas Gregor2012-11-151-1/+3
| | | | llvm-svn: 168077
* [analyzer] Report leaks at the closing brace of a function body.Jordan Rose2012-11-153-13/+24
| | | | | | | | | | | | | | | | | | | | This fixes a few cases where we'd emit path notes like this: +---+ 1| v p = malloc(len); ^ |2 +---+ In general this should make path notes more consistent and more correct, especially in cases where the leak happens on the false branch of an if that jumps directly to the end of the function. There are a couple places where the leak is reported farther away from the cause; these are usually cases where there are several levels of nested braces before the end of the function. This still matches our current behavior for when there /is/ a statement after all the braces, though. llvm-svn: 168070
* [analyzer] StreamChecker: Remove now-unnecessary check::EndPath callback.Jordan Rose2012-11-151-46/+1
| | | | | | | Also, don't bother to stop tracking symbols in the return value, either. They are now properly considered live during checkDeadSymbols. llvm-svn: 168069
* [analyzer] MacOSKeychainAPIChecker: Remove now-unnecessary check::EndPath.Jordan Rose2012-11-151-75/+0
| | | | | | | Also, don't bother to stop tracking symbols in the return value, either. They are now properly considered live during checkDeadSymbols. llvm-svn: 168068
* [analyzer] MallocChecker: Remove now-unnecessary check::EndPath callback.Jordan Rose2012-11-151-29/+1
| | | | | | | Also, don't bother to stop tracking symbols in the return value, either. They are now properly considered live during checkDeadSymbols. llvm-svn: 168067
* [analyzer] Mark symbol values as dead in the environment.Jordan Rose2012-11-153-20/+37
| | | | | | | | | | | | | | This allows us to properly remove dead bindings at the end of the top-level stack frame, using the ReturnStmt, if there is one, to keep the return value live. This in turn removes the need for a check::EndPath callback in leak checkers. This does cause some changes in the path notes for leak checkers. Previously, a leak would be reported at the location of the closing brace in a function. Now, it gets reported at the last statement. This matches the way leaks are currently reported for inlined functions, but is less than ideal for both. llvm-svn: 168066
* block extended signatur option. Change previous optionFariborz Jahanian2012-11-154-4/+13
| | | | | | | | to a cc1 -fencode-extended-block-signature and pass it to cc1 and recognize this option to produce extended block type signature. // rdar://12109031 llvm-svn: 168063
* [modules] Use a memory buffer directly as input for the module includes,Argyrios Kyrtzidis2012-11-153-13/+14
| | | | | | instead of messing with virtual files. llvm-svn: 168062
* [modules] Setup the import location of a module file and use itArgyrios Kyrtzidis2012-11-155-13/+36
| | | | | | as the include location of the main file of an imported module. llvm-svn: 168061
* Simplify code. No functionality change.Benjamin Kramer2012-11-151-18/+12
| | | | llvm-svn: 168047
* Do not cache a pointer to ExprEvalContexts.back().Benjamin Kramer2012-11-151-7/+9
| | | | | | | | | | It may become a dangling pointer if the underlying SmallVector reallocates. Sadly the testcase is really large and doesn't reduce well because of SmallVector's reallocation patterns. Fixes PR14336. llvm-svn: 168045
* Use empty parens for empty function parameter list instead of '(void)'.Dmitri Gribenko2012-11-156-10/+10
| | | | llvm-svn: 168041
* Teach the uninitialized field warning about anonymous structs and union members.Nick Lewycky2012-11-151-9/+23
| | | | | | Fixes PR14073! llvm-svn: 168031
* Make -ffp-contract a codegen option, rather than a laguage option. This makesLang Hames2012-11-153-17/+17
| | | | | | | more sense anyway - it determines how expressions are codegen'd. It also ensures that -ffp-contract=fast has the intended effect when compiling LLVM IR. llvm-svn: 168027
* Revert r167567, restoring the ability of clang to run gcc in cases where itNick Lewycky2012-11-156-35/+796
| | | | | | can't handle the input file type. This resulted in PR14338. llvm-svn: 168024
* Fix an off-by-one error by switching < to <= in ↵Richard Trieu2012-11-151-1/+1
| | | | | | -Wtautological-constant-out-of-range-compare and added test case. llvm-svn: 168023
* Do not use data recursion in ASTMatchFinder.Daniel Jasper2012-11-151-0/+9
| | | | | | The matchers rely on the complete AST being traversed as shown by the new test cases. llvm-svn: 168022
* [analyzer] Make sure calls in synthesized functions have valid path locations.Jordan Rose2012-11-152-10/+20
| | | | | | | | | | | | | | | | | | We do this by using the "most recent" good location: if a synthesized function 'A' calls another function 'B', the path notes for the call to 'B' will be placed at the same location as the path note for calling 'A'. Similarly, the call to 'A' will have a note saying "Entered call from...", and now we just don't emit that (since the user doesn't have a body to look at anyway). Previously, we were doing this for the "Calling..." notes, but not for the "Entered call from..." or "Returning to caller". This caused a crash when the path entered and then exiting a call within a synthesized body. <rdar://problem/12657843> llvm-svn: 168019
* Fix a trivial bool-related bug I spotted while skimming David Fang'sEli Friedman2012-11-151-2/+2
| | | | | | current list of powerpc-darwin8 failures. llvm-svn: 168016
* Per [basic.lookup.classref]p3, in an expression of the form p->~type-name, theRichard Smith2012-11-151-1/+1
| | | | | | | | | | type-name is looked up in the context of the complete postfix-expression. Don't forget to pass the scope into this lookup when the type-name is a template-id; it might name an alias template which can't be found within the class itself. Bug spotted by Johannes Schaub on #llvm. llvm-svn: 168011
* Fix DiagnoseBitwisePrecedence so it doesn't cast "-1" to the typeEli Friedman2012-11-151-24/+16
| | | | | | | | | BinaryOperator::Opcode. This is bad form, and the behavior of the static_cast in this case is unspecified according to the standard. Fixes a warning that showed up from r167992 on self-host. llvm-svn: 168010
* Make template diffing handle integral expressions of various widths correctly.Eli Friedman2012-11-141-4/+17
| | | | | | PR14342. llvm-svn: 168005
* Add -cc1 option -fno-diagnostics-use-presumed-location, a handy mode forRichard Smith2012-11-143-4/+6
| | | | | | | | | working with preprocessed testcases. This causes source locations in diagnostics to point at the spelling location instead of the presumed location, while still keeping the semantic effects of the line directives (entering and leaving system-header mode, primarily). llvm-svn: 168004
* objective-C blocks: under cc1 flag -encode-extended-block-signature,Fariborz Jahanian2012-11-142-2/+14
| | | | | | | | generate expanded signature encoding to include types as we already do this for protocol method lists. // rdar://12109031 llvm-svn: 167997
* Improve -Wtautological-constant-out-of-range-compare by taking into accountRichard Trieu2012-11-141-15/+73
| | | | | | | | | type conversion between integers. This allows the warning to be more accurate. Also, turned the warning off in an analyzer test. The relavent test cases are covered by the tests in Sema. llvm-svn: 167992
OpenPOWER on IntegriCloud