summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Rename AnalyzerOptions 'EagerlyAssume' to 'eagerlyAssumeBinOpBifurcation'.Ted Kremenek2012-08-303-14/+16
| | | | llvm-svn: 162930
* Store const& to AnalyzerOptions in AnalysisManager instead of copyingTed Kremenek2012-08-305-67/+35
| | | | | | individual flags. llvm-svn: 162929
* Move AnalyzerOptions.h to include/clang/StaticAnalyzer.Ted Kremenek2012-08-302-2/+2
| | | | llvm-svn: 162928
* Move Analyses.def to include/clang/StaticAnalyzer.Ted Kremenek2012-08-302-15/+15
| | | | llvm-svn: 162927
* objective-C: clang must implicitly convert Fariborz Jahanian2012-08-302-1/+14
| | | | | | | | | | | __objc_yes/__objc_no to (BOOL)1/(BOOL)0 when BOOL is declared; otherwise it resorts to default of 'signed char'. This is important to selecting the correct Numeric API numberWithBool: Can't have a clang test for this. Will checkin and executable llvm test. // rdar://12156616 llvm-svn: 162922
* Make preprocessor act in a GCC-compatible fashion when a macro is redefinedRichard Smith2012-08-303-6/+7
| | | | | | | | within its own argument list. The original definition is used for the immediate expansion, but the new definition is used for any subsequent occurences within the argument list or after the expansion. llvm-svn: 162906
* PR13652: Don't assume the parameter array on a FunctionTypeLoc for a lambda willRichard Smith2012-08-301-6/+5
| | | | | | | be filled in; they won't if the lambda's declarator has an invalid type. Instead take the parameters from the declarator directly. llvm-svn: 162904
* Change -analyzer-config to use '=' as the key-value separator, and onlyTed Kremenek2012-08-301-3/+3
| | | | | | support the '-analyzer-config key=val' variant. llvm-svn: 162891
* Reland r160052: Default to -std=c++11 on Windows.Nico Weber2012-08-301-2/+5
| | | | | | Also update the tests that rely on c++98 to explicitly mention that. llvm-svn: 162890
* Tooling: Add a runToolOnCodeWithArgs() function that allowsNico Weber2012-08-301-8/+13
| | | | | | | | passing additional parameters to a tool. Use this to fix a FIXME in testing code. llvm-svn: 162889
* Fix a crash in type merging with enum types.Eli Friedman2012-08-301-3/+6
| | | | llvm-svn: 162886
* Emit .gcda files as absolute paths instead of relative paths.Bill Wendling2012-08-301-1/+3
| | | | | | | | | | | | This improves compatibility with gcc in this regard, and this file generation can be ameliorated with GCOV_PREFIX and GCOV_PREFIX_STRIP. It's also useful if your build directory doesn't specify -o <abspath> and it uses a recursive make structure, so it's not relative to the toplevel. Patch by Joshua Cranmer! <rdar://problem/12179524> llvm-svn: 162884
* [analyzer] Stop tracking symbols based on a retain count summary ofAnna Zaks2012-08-291-27/+101
| | | | | | | | | | | | inlined function. This resolves retain count checker false positives that are caused by inlining ObjC and other methods. Essentially, if we are passing an object to a method with "delegate" in the selector or a function pointer as another argument, we should stop tracking the other parameters/return value as far as the retain count checker is concerned. llvm-svn: 162876
* [analyzer] Fixup 162863.Anna Zaks2012-08-291-3/+3
| | | | | | Thanks Jordan. llvm-svn: 162875
* Fix serious regression introduced in r157780 where __attribute__((NSObject))Ted Kremenek2012-08-291-4/+2
| | | | | | | | could not be attached to a CFTypeRef. Fixes <rdar://problem/12197822> llvm-svn: 162872
* [analyzer] Improved diagnostic pruning for calls initializing values.Anna Zaks2012-08-297-120/+198
| | | | | | | | | | | | | | | | | | | | This heuristic addresses the case when a pointer (or ref) is passed to a function, which initializes the variable (or sets it to something other than '0'). On the branch where the inlined function does not set the value, we report use of undefined value (or NULL pointer dereference). The access happens in the caller and the path through the callee would get pruned away with regular path pruning. To solve this issue, we previously disabled diagnostic pruning completely on undefined and null pointer dereference checks, which entailed very verbose diagnostics in most cases. Furthermore, not all of the undef value checks had the diagnostic pruning disabled. This patch implements the following heuristic: if we pass a pointer (or ref) to the region (on which the error is reported) into a function and it's value is either undef or 'NULL' (and is a pointer), do not prune the function. llvm-svn: 162863
* Make alignment computation for pointer values for builtins handleEli Friedman2012-08-291-1/+2
| | | | | | non-pointer types with a pointer representation correctly. PR13660. llvm-svn: 162862
* Define __mips64 / __mips64__ macros for MIPS 64-bit targets.Simon Atanasyan2012-08-291-0/+3
| | | | | | The patch suggested by Brad Smith. llvm-svn: 162858
* Use getTargetDefines() virtual function in MipsTargetInfoBase successorsSimon Atanasyan2012-08-291-14/+12
| | | | | | | to define all macros for MIPS targets. Remove redundant virtual function getArchDefines(). Two virtual functions for this task are really too much. llvm-svn: 162853
* Factor out MIPS macro definitions common for all MIPS targets.Simon Atanasyan2012-08-291-12/+4
| | | | llvm-svn: 162852
* Move TLS check from LValueExprEvaluator::VisitVarDecl toHans Wennborg2012-08-291-2/+8
| | | | | | | | | | | CheckLValueConstantExpression. Richard pointed out that using the address of a TLS variable is ok in a core C++11 constant expression, as long as it isn't part of the eventual result of constant expression evaluation. Having the check in CheckLValueConstantExpression accomplishes this. llvm-svn: 162850
* objective-C: make -Widiomatic-parentheses workFariborz Jahanian2012-08-291-1/+3
| | | | | | | when assignment expression in conditional invloves property reference. // rdar://11066598 llvm-svn: 162846
* Fixed a problem with #pragma push_macro/pop_macro implementation.Alexander Kornienko2012-08-293-6/+17
| | | | | | | | | | | | | | | | | | | | Summary: The problem was with the following sequence: #pragma push_macro("long") #undef long #pragma pop_macro("long") in case when "long" didn't represent a macro. Fixed crash and removed code duplication for #undef/pop_macro case. Added regression tests. Reviewers: doug.gregor, klimek Reviewed By: doug.gregor CC: cfe-commits, chapuni Differential Revision: http://llvm-reviews.chandlerc.com/D31 llvm-svn: 162845
* Define _MIPS_ARCH and _MIPS_ARCH_<cpu name> macros for MIPS targets.Simon Atanasyan2012-08-291-0/+3
| | | | | | The patch suggested by Logan Chien. llvm-svn: 162840
* Reversing the logic since C99 mode is actually not an extension. Also, ↵Aaron Ballman2012-08-291-2/+2
| | | | | | changing the group to the singular to match the diagnostic better. llvm-svn: 162838
* Fix r162835 as per Richard's comments.Hans Wennborg2012-08-291-1/+1
| | | | | | | VisitVarDecl should return Error(E), and we should test that the address of a TLS var can't be used as a constexpr. llvm-svn: 162837
* The address of a TLS var is not compile-time constant (PR13720)Hans Wennborg2012-08-291-0/+2
| | | | | | | | | | | | This makes Clang produce an error for code such as: __thread int x; int *p = &x; The lvalue of a thread-local variable cannot be evaluated at compile time. llvm-svn: 162835
* Add new -cc1 driver option -analyzer-config, which allows one to specifyTed Kremenek2012-08-293-6/+43
| | | | | | | | | a comma separated collection of key:value pairs (which are strings). This allows a general way to provide analyzer configuration data from the command line. No clients yet. llvm-svn: 162827
* [analyzer] C++ objects returned on the stack may be wrapped in ExprWithCleanups.Jordan Rose2012-08-291-1/+5
| | | | | | | | | | | | In C++, objects being returned on the stack are actually copy-constructed into the return value. That means that when a temporary is returned, it still has to be destroyed, i.e. the returned expression will be wrapped in an ExprWithCleanups node. Our "returning stack memory" checker needs to look through this node to see if we really are returning an object by value. PR13722 llvm-svn: 162817
* Keep history of macro definitions and #undefsAlexander Kornienko2012-08-297-66/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Modifes BoundNodes to store void* and allow casting themManuel Klimek2012-08-281-42/+24
| | | | | | | | | | | | | into the correct types when pulling them out in the result callback in a type safe way. This is also the base change for multiple things that will allow handling things more generally and thus supporting more of the AST, especially handling Type nodes. Patch contributed by Michael Diamond. llvm-svn: 162804
* objective-C arc: ns_returns_retained is a type attribute in ARC,Fariborz Jahanian2012-08-281-2/+2
| | | | | | | | and when used in property type declaration, is handled as type attribute. Do not issue the warning when declaraing the property. // rdar://12173491 llvm-svn: 162801
* Only add common tool options when CommonOptionsParser is used.Alexander Kornienko2012-08-281-5/+5
| | | | | | | | | | | | | | Summary: Subj. Reviewers: chandlerc, klimek, djasper Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D29 llvm-svn: 162798
* Revert r162424 now that the scoping issue has been fixed in r162444.Chad Rosier2012-08-281-2/+2
| | | | llvm-svn: 162797
* [ms-inline asm] Have MSAsmStmts use the generic EmitAsmStmt codegen function.Chad Rosier2012-08-282-41/+6
| | | | llvm-svn: 162796
* Splitting the duplicated decl spec extension warning into two: one is an ↵Aaron Ballman2012-08-281-6/+16
| | | | | | ExtWarn and the other a vanilla warning. This addresses PR13705, where const char const * wouldn't warn unless -pedantic was specified under the right conditions. llvm-svn: 162793
* [analyzer] Teach CallEventManager that CXXTemporaryObjectExpr is also a ctor.Jordan Rose2012-08-281-1/+2
| | | | | | | | | | | | | | Specifically, CallEventManager::getCaller was looking at the call site for an inlined call and trying to see what kind of call it was, but it only checked for CXXConstructExprClass. (It's not using an isa<> here to avoid doing three more checks on the the statement class.) This caused an unreachable when we actually did inline the constructor of a temporary object. PR13717 llvm-svn: 162792
* [analyzer] When we look for the last stmt in a function, skip implicit dtors.Jordan Rose2012-08-281-12/+21
| | | | | | | | | | | | | When exiting a function, the analyzer looks for the last statement in the function to see if it's a return statement (and thus bind the return value). However, the search for "the last statement" was accepting statements that were in implicitly-generated inlined functions (i.e. destructors). So we'd go and get the statement from the destructor, and then say "oh look, this function had no explicit return...guess there's no return value". And /that/ led to the value being returned being declared dead, and all our leak checkers complaining. llvm-svn: 162791
* CUDA: give static storage class to __shared__ and __constant__Peter Collingbourne2012-08-281-0/+8
| | | | | | | | variables without a storage class within a function, to implement CUDA B.2.5: "__shared__ and __constant__ variables have implied static storage [duration]." llvm-svn: 162788
* CUDA: give correct address space to globals declared in functionsPeter Collingbourne2012-08-281-1/+3
| | | | llvm-svn: 162787
* Tidy up.Chad Rosier2012-08-281-1/+1
| | | | llvm-svn: 162786
* [ms-inline asm] Have generateAsmString() return the AsmString computed by Sema.Chad Rosier2012-08-281-1/+1
| | | | | | | | We still need to translate the string, but this at least gets us one step closer to using the more general EmitAsmStmt() codegen function. No functional change intended. llvm-svn: 162785
* [ms-inline asm] Add constraints to MSAsmStmt. We don't currently computeChad Rosier2012-08-282-25/+33
| | | | | | | the constraints, so in the interim we speculatively assume a 'r' constraint. This is expected to work for most cases on x86. llvm-svn: 162784
* [ms-inline asm] Rename EmitGCCAsmStmt to EmitAsmStmt and have it accept Chad Rosier2012-08-282-6/+8
| | | | | | | | AsmStmts. This function is only used by GCCAsmStmts, however. Constraints need to be properly computed before MSAsmStmts can use EmitAsmStmt. No functional change intended. llvm-svn: 162776
* [ms-inline asm] Use dyn_cast<> here to simplify logic.Chad Rosier2012-08-281-30/+24
| | | | llvm-svn: 162773
* [analyzer] Don't purge dead symbols at the end of calls if -analyzer-purge=none.Jordan Rose2012-08-281-1/+1
| | | | | | | | No test case since this is a debug option that we will never turn on by default since it makes the leak checkers much less useful. (We'll only report leaks at the end of analysis if -analyzer-purge=none.) llvm-svn: 162772
* [ms-inline asm] Make the AsmStmt class non-virtual.Chad Rosier2012-08-281-0/+54
| | | | llvm-svn: 162768
* Fix PR13704Michael Liao2012-08-281-1/+1
| | | | | | | - The increment needs to be signed value to preserve the original value when its data type is larger than 64-bit integer. llvm-svn: 162766
* Warn about suspicious implicit conversions from floating point to boolHans Wennborg2012-08-281-0/+64
| | | | | | | | | | | | | | | | | | | | | This warns in two specific situations: 1) For potentially swapped function arguments, e.g. void foo(bool, float); foo(1.7, false); 2) Misplaced brackets around function call arguments, e.g. bool InRange = fabs(a - b < delta); Where the last argument in a function call is implicitly converted from bool to float, and the function returns a float which gets implicitly converted to bool. Patch by Andreas Eckleder! llvm-svn: 162763
* Cleanup FreeBSD linking and add support for -pie.Roman Divacky2012-08-281-32/+38
| | | | | | Path by Brooks Davis, tests and fixes from me. llvm-svn: 162761
OpenPOWER on IntegriCloud