summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-add an over-zealously removed break.David Blaikie2012-01-171-0/+1
| | | | llvm-svn: 148296
* Remove dead comments as per Chandler's feedback to r148292David Blaikie2012-01-171-2/+0
| | | | llvm-svn: 148294
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-1733-145/+61
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-1730-54/+12
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Introduce a CodeCompletionResult::CreateCodeCompletionString() thatArgyrios Kyrtzidis2012-01-172-22/+34
| | | | | | | | does not depend on Sema, it accepts an ASTContext and a Preprocessor. Step towards making clang_getCursorCompletionString not depend on Sema. llvm-svn: 148278
* Introduce a static Sema::MarkDeducedTemplateParameters() that only dependsArgyrios Kyrtzidis2012-01-171-51/+53
| | | | | | | | on an ASTContext. This is a step towards making clang_getCursorCompletionString not depend on Sema. llvm-svn: 148277
* Revert r148271; this requires more thought.Eli Friedman2012-01-171-28/+11
| | | | llvm-svn: 148276
* Change the behavior of the lvalue-to-rvalue conversion for varargs in ↵Eli Friedman2012-01-171-11/+28
| | | | | | | | PotentiallyPotentiallyEvaluated contexts so that we model it in a sane way in most cases, and give up for the edge case which hopefully doesn't matter too much. In preparation for correctly treating sizeof() as a PotentiallyPotentiallyEvaluated context. llvm-svn: 148271
* Improve diagnostics for dangling '}'.Nico Weber2012-01-171-1/+1
| | | | | | Fixes PR6484. Patch from Jason Switzer! llvm-svn: 148270
* Use Builtin ID as the return valueAnna Zaks2012-01-172-41/+56
| | | | | | | | | | for FunctionDecl::getMemoryFunctionKind(). This is a follow up on the Chris's review for r148142: We don't want to pollute FunctionDecl with an extra enum. (To make this work, added memcmp and family to the library builtins.) llvm-svn: 148267
* [analyzer] Taint: generalize taint propagation to simplify adding moreAnna Zaks2012-01-171-4/+128
| | | | | | taint propagation functions. llvm-svn: 148266
* Add support for OpenCL 1.1 logical operations.Tanya Lattner2012-01-162-16/+77
| | | | llvm-svn: 148254
* Add some calls to MarkDeclarationReferenced, towards a point where every ↵Eli Friedman2012-01-162-1/+8
| | | | | | declaration which is used is marked as used. llvm-svn: 148253
* Make the auto-detection hack for the iOS simulator set the target triple ↵Eli Friedman2012-01-161-22/+25
| | | | | | correctly. Getting the target triple wrong mostly appears to work, but messes up in subtle cases; for example, we incorrectly conclude that fwrite is actually named fwrite$UNIX2003. Also shuffles around the auto-detection code a bit to try and make it a bit more reliable. Fixes <rdar://problem/10664848>. llvm-svn: 148249
* Fixes a crash during constant folding of a switch and case Fariborz Jahanian2012-01-161-0/+10
| | | | | | | statement which has an unscoped case inside it. Patch by Aaron Ballman llvm-svn: 148243
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-1616-24/+209
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* Refactor variables unused under non-assert builds.David Blaikie2012-01-162-4/+2
| | | | llvm-svn: 148229
* Now that deserializing a definition of a C++ class/Objective-CDouglas Gregor2012-01-152-39/+14
| | | | | | | | | | class/Objective-C protocol suffices get all of the redeclarations of that declaration wired to the definition, we no longer need to record the identity of the definition in every declaration. Instead, just record a bit to indicate whether a particular declaration is the definition. llvm-svn: 148224
* When deserializing the definition of a C++ class/ObjC class/ObjCDouglas Gregor2012-01-154-104/+25
| | | | | | | | | | | | | | | protocol, record the definition pointer in the canonical declaration for that entity, and then propagate that definition pointer from the canonical declaration to all other deserialized declarations. This approach works well even when deserializing declarations that didn't know about the original definition, which can occur with modules. A nice bonus from this definition-deserialization approach is that we no longer need update records when a definition is added, because the redeclaration chains ensure that the if any declaration is loaded, the definition will also get loaded. llvm-svn: 148223
* Completely re-implement (de-)serialization of redeclarationDouglas Gregor2012-01-155-136/+154
| | | | | | | | | | | | | | | | chains, again. The prior implementation was very linked-list oriented, and the list-splicing logic was both fairly convoluted (when loading from multiple modules) and failed to preserve a reasonable ordering for the redeclaration chains. This new implementation uses a simpler strategy, where we store the ordered redeclaration chains in an array-like structure (indexed based on the first declaration), and use that ordering to add individual deserialized declarations to the end of the existing chain. That way, the chain mimics the ordering from its modules, and a bug somewhere is far less likely to result in a broken linked list. llvm-svn: 148222
* Two variables had been added for an assert, but their values wereChandler Carruth2012-01-151-3/+3
| | | | | | | | | | re-computed rather than the variables be re-used just after the assert. Just use the variables since we have them already. Fixes an unused variable warning. Also fix an 80-column violation. llvm-svn: 148212
* decltype(e) is type-dependent if e is instantiation-dependent. Scary but true.Richard Smith2012-01-151-1/+4
| | | | | | | Don't consider decltype(e) for an instantiation-dependent, but not type-dependent, e to be non-type-dependent but canonical(!). llvm-svn: 148210
* Pedantic diagnostic correction: in C++, we have integral constant expressions,Richard Smith2012-01-151-9/+8
| | | | | | | | not integer constant expressions. In passing, fix the 'folding is an extension' diagnostic to not claim we're accepting the code, since that's not true in -pedantic-errors mode, and add this diagnostic to -Wgnu. llvm-svn: 148209
* constexpr: casts to void* are allowed in constant expressions, don't set theRichard Smith2012-01-151-3/+3
| | | | | | | designator invalid. (Since we can't read the value of such a pointer, this only affects the quality of diagnostics.) llvm-svn: 148208
* Change linkage computation so it doesn't depend on FunctionDecl::isExternC ↵Eli Friedman2012-01-151-39/+27
| | | | | | | | or VarDecl::isExternC, and instead queries what it actually cares about: whether the given declaration is inside an extern "C" context. Fundamentally, figuring out whether a function/variable uses C linkage requires knowing the linkage, and the logic in FunctionDecl::isExternC and VarDecl::isExternC was getting it wrong. Given that, fix FunctionDecl::isExternC and VarDecl::isExternC to use much simpler implementations that depend on the fixed linkage computation. Fixes a regression to test/SemaCXX/linkage.cpp caused by a new warning exposing the fact that the internal state was wrong. llvm-svn: 148207
* Use a smaller vector than SmallVector.Benjamin Kramer2012-01-142-6/+4
| | | | | | Shrinks OverloadCandidate from 208 to 168 bytes. llvm-svn: 148204
* Clear ImplicitConversionSequence the obvious way which turns out to be less ↵Benjamin Kramer2012-01-141-4/+3
| | | | | | fragile. llvm-svn: 148200
* Give OverloadCandidateSet the responsibility for destroying the implicit ↵Benjamin Kramer2012-01-141-1/+5
| | | | | | conversion sequences so we don't get double frees when the vector reallocates. llvm-svn: 148198
* objc: disallow __block attribute on method params.Fariborz Jahanian2012-01-141-0/+4
| | | | llvm-svn: 148197
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-1417-74/+74
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Pool allocate ImplicitConversionSequences.Benjamin Kramer2012-01-141-9/+10
| | | | | | | | | | | | | | | | To avoid malloc thrashing give OverloadCandidateSet an inline capacity for conversion sequences. We use the fact that OverloadCandidates never outlive the OverloadCandidateSet and have a fixed amount of conversion sequences. This eliminates the oversized SmallVector from OverloadCandidate shrinking it from 752 to 208 bytes. On the test case from the "Why is CLANG++ so freaking slow" thread on llvmdev this avoids one gig of vector reallocation (including memcpy) which translates into 5-10% speedup on Lion/x86_64. Overload candidate computation is still the biggest malloc contributor when compiling templated c++ code. llvm-svn: 148186
* OverloadCandidateSet: Stop exposing SmallVector internalsBenjamin Kramer2012-01-141-22/+9
| | | | | | | Replace push_back with addCandidate which will let us make use of the fixed size of the conversion sequence vector soon. llvm-svn: 148185
* Introduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),Douglas Gregor2012-01-142-66/+9
| | | | | | | | virtual functions that provide previous/most recent redeclaration information for any declaration. Use this to eliminate the redundant, less efficient getPreviousDecl() functions. llvm-svn: 148184
* Revert accidental commitDouglas Gregor2012-01-141-3/+1
| | | | llvm-svn: 148183
* Add a FIXME for mutation of the common pointer of a ↵Douglas Gregor2012-01-142-2/+8
| | | | | | RedeclarableTemplateDecl. It is not clear that it's worth delaying the allocation of said pointer llvm-svn: 148182
* Reimplement RedeclarableTemplateDecl in terms ofDouglas Gregor2012-01-144-120/+68
| | | | | | | | | | | Redeclarable<RedeclarableTemplateDecl>, eliminating a bunch of redeclaration-chain logic both in RedeclarableTemplateDecl and especially in its (de-)serialization. As part of this, eliminate the RedeclarableTemplate<> class template, which was an abstraction that didn't actually save anything. llvm-svn: 148181
* Remove a redundant word.Zhongxing Xu2012-01-141-1/+1
| | | | llvm-svn: 148179
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-1412-233/+440
| | | | | | | | | | | | | | | | | | | | APValue::Array and APValue::MemberPointer. All APValue values can now be emitted as constants. Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other entrypoints dealing with constant member pointers are no longer necessary and will be removed in a later change. Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to VarDecl::evaluateValue. This performs caching and deals with the nasty cases in C++11 where a non-const object's initializer can refer indirectly to previously-initialized fields within the same object. Building the intermediate APValue object incurs a measurable performance hit on pathological testcases with huge initializer lists, so we continue to build IR directly from the Expr nodes for array and record types outside of C++11. llvm-svn: 148178
* [analyzer] Taint: add system and popen as undesirable sinks for taintAnna Zaks2012-01-141-20/+77
| | | | | | data. llvm-svn: 148176
* Remember if a type has its visibility set explicitly or implicitly.Rafael Espindola2012-01-142-48/+53
| | | | | | | | With that, centralize the way we merge visibility, always preferring explicit over implicit and then picking the most restrictive one. Fixes pr10113 and pr11690. llvm-svn: 148163
* Fix 80-column violation.Chad Rosier2012-01-141-1/+2
| | | | llvm-svn: 148162
* (Implicit) parameters deserialized as part of a function type must notDouglas Gregor2012-01-131-2/+4
| | | | | | | get added to the identifier chains as part of deserialization, because they should not be visible to name lookup. llvm-svn: 148159
* Progress towards making isUsed() reflect whether a declaration is odr-used; ↵Eli Friedman2012-01-133-12/+3
| | | | | | | | don't set isUsed for local variables which are referenced in unevaluated contexts. Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate. I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check. Someone who actually understands the semantics here should fix that. llvm-svn: 148158
* Fix a silly mistake in ComplexExprEvaluator::ZeroInitialization. ↵Eli Friedman2012-01-131-1/+1
| | | | | | <rdar://problem/10691092>. llvm-svn: 148157
* Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.Kaelyn Uhrain2012-01-132-15/+31
| | | | | | | | The change to SemaTemplateVariadic.cpp improves the typo correction results in certain situations, while the change to SemaTemplate.cpp does not change existing behavior. llvm-svn: 148155
* Make sure to consider non-DeclContext scopes properly when findingDouglas Gregor2012-01-131-10/+30
| | | | | | | multiple name lookup results in C/Objective-C. Fixes a regression a caused in r147533, found by Enea Zaffanella! llvm-svn: 148154
* When inferring a module for a framework, first determine whether thatDouglas Gregor2012-01-131-3/+44
| | | | | | | | | | | | | framework is actually a subframework within a top-level framework. If so, only infer a module for the top-level framework and then dig out the appropriate submodule. This helps us cope with an amusing subframeworks anti-pattern, where one uses -F <framework>/Frameworks to get direct include access to the subframeworks of a framework (which otherwise would not be permitted). llvm-svn: 148148
* Move identification of memory setting and copying functions (memset,Anna Zaks2012-01-132-88/+97
| | | | | | | memcmp, strncmp,..) out of Sema and into FunctionDecl so that the logic could be reused in the analyzer. llvm-svn: 148142
* Revert r148138; it's causing test failures.Eli Friedman2012-01-132-2/+2
| | | | llvm-svn: 148141
* Convert SemaExprMember.cpp to pass a callback object to CorrectTypo,Kaelyn Uhrain2012-01-131-12/+23
| | | | | | | | | improving the typo correction results in certain situations. This is also the first typo correction callback conversion to affect an existing unit test. :) llvm-svn: 148140
OpenPOWER on IntegriCloud