Граф коммитов

23095 Коммитов

Автор SHA1 Сообщение Дата
Eli Friedman 79430e9983 Minor cleanup; no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 00:49:17 +00:00
John McCall 7307643160 The value of a const weak variable is not an integer constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147575 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 00:13:19 +00:00
Douglas Gregor c634f50c5c If we already have a definition for a top-level module that we deserialized from a module file, don't bother parsing a new definition
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147574 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 00:12:00 +00:00
Fariborz Jahanian c3953aab1b Fixes a code gen bug for setter code for a property of
c++ object reference type with trivial copy constructor.
This causes an assert crash and bad code gen. when assert 
is off. // rdar://6137845


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147573 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 00:10:16 +00:00
Douglas Gregor 752769f080 When generating includes for all of the headers we found in an
umbrella directory, skip includes for any headers that are part of an
unavailable module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147572 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 00:04:05 +00:00
Anna Zaks eb31a76d1c [analyzer] Be less pessimistic about invalidation of global variables
as a result of a call.

Problem:
Global variables, which come in from system libraries should not be
invalidated by all calls. Also, non-system globals should not be
invalidated by system calls.

Solution:
The following solution to invalidation of globals seems flexible enough
for taint (does not invalidate stdin) and should not lead to too
many false positives. We split globals into 3 classes:

* immutable - values are preserved by calls (unless the specific
global is passed in as a parameter):
     A :  Most system globals and const scalars

* invalidated by functions defined in system headers:
     B: errno

* invalidated by all other functions (note, these functions may in
turn contain system calls):
     B: errno
     C: all other globals (which are not in A nor B)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147569 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 23:54:01 +00:00
Ted Kremenek 22f18fd72d Rename attribute 'objc_suppress_autosynthesis' to 'objc_disable_automatic_synthesis'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 23:51:09 +00:00
Ted Kremenek e3659a78a9 Fix 80 col violations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 23:48:37 +00:00
Douglas Gregor b7a7819473 Store the submodules of a module in source order, as they are stored
in the module map. This provides a bit more predictability for the
user, as well as eliminating the need to sort the submodules when
serializing them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 23:32:19 +00:00
Fariborz Jahanian da611a74c4 objc: When issuing warning for missing synthesis for
properties in classes declared with objc_suppress_autosynthesis
attribute, pinpoint location of the said class in a note.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 23:16:13 +00:00
Eli Friedman 6563928411 Add an APValue representation for the difference between two address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer.
With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary.

Fixes PR11705.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147561 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 23:13:47 +00:00
Chris Lattner 44a239973d implement rdar://10639962 by keeping track of increased alignment
information even in subscripting operations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147557 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 22:35:55 +00:00
Daniel Dunbar d2d2088c56 Driver/Darwin: Remove a hack that avoided passing -demangle to iOS linkers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147552 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 21:45:27 +00:00
Douglas Gregor bd507c5ef3 Add __has_feature(modules) to indicate when modules are available (in
any language variant), and restrict __has_feature(objc_modules) to
mean that we also have the Objective-C @import syntax. I anticipate
__has_feature(cxx_modules) and/or __has_feature(c_modules) for when we
nail down the module syntax for C/C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147548 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 21:16:09 +00:00
Douglas Gregor 4791fa2c3c Implement declaration merging for variables in disjoint modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147535 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 17:21:36 +00:00
Douglas Gregor 7076281fca Implement declaration merging for non-template functions from
different modules. This implementation is a first approximation of
what we want, using only the function type to determine
equivalence. Later, we'll want to deal with some of the more subtle
issues, including:

  - C allows a prototyped declaration and a non-prototyped declaration
    to be merged, which we should support
  - We may want to ignore the return type when merging, then
    complain if the return types differ. Or, we may want to leave it
    as it us, so that we only complain if overload resolution
    eventually fails.
  - C++ non-static member functions need to consider cv-qualifiers
    and ref-qualifiers.
  - Function templates need to consider the template parameters and
    return type.
  - Function template specializations will have special rules.
  - We can now (accidentally!) end up overloading in C, even without
    the "overloadable" attribute, and will need to detect this at some
    point.
  
The actual detection of "is this an overload?" is implemented by
Sema::IsOverload(), which will need to be moved into the AST library
for re-use here. That will be a future refactor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147534 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 17:13:46 +00:00
Douglas Gregor da795b45f4 Implement declaration merging for typedefs loaded from disjoint
modules, so long as the typedefs refer to the same underlying
type. This ensures that the typedefs end up in the same redeclaration
chain.

To test this, fix name lookup for C/Objective-C to properly deal with
multiple declarations with the same name in the same scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147533 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 16:44:10 +00:00
Benjamin Kramer b3453a8104 Penryn doesn't support sse4.2, don't enable it in the first place.
While the code took care of disabling the sse42 flag it didn't know
about popcnt. This broke -march=native on penryn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 14:36:57 +00:00
David Chisnall 13df6f6e2e Restore r147493 and remove the part of the test that was checking the wrong thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147530 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 12:02:13 +00:00
Ted Kremenek d1247c5002 Extend ConditionBRVisitor to handle condition variable assignments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 08:18:09 +00:00
Douglas Gregor d6aba06861 Don't treat 'import' as a contextual keyword when we're in a caching lexer, or when modules are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147524 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 06:20:15 +00:00
Rafael Espindola 256fc4d074 Process attributes in explicit function template instantiations. Fixes part of
PR11690.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147523 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 05:40:59 +00:00
Eli Friedman f88c400085 Add an explicit LambdaExprContext to Declarator, to parallel BlockLiteralContext. Use it to ensure semantic analysis of types isn't confused by the lack of a type specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 04:41:38 +00:00
Akira Hatanaka c7ecc2e369 Have functions return structures smaller than 128-bit in registers if ABI
is either N32 or N64. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147520 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 03:34:42 +00:00
Eli Friedman deeab90783 Fix messed-up indentation in r147515.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147517 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 02:46:53 +00:00
Eli Friedman dc3b723d35 Stub out the Sema interface for lambda expressions, and change the parser to use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147515 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 02:40:39 +00:00
Rafael Espindola 4cd55b04e3 Revert r147493. It broke test/CodeGenObjC/constant-strings.m.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147511 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 01:32:19 +00:00
Ted Kremenek 1c87980ef1 Teach the static analyzer to not treat XPC types as CF types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147506 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 00:35:48 +00:00
Ted Kremenek 0507f7ee76 Minor code formatting cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147505 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 00:35:45 +00:00
Fariborz Jahanian 9f37cd1810 In non-gc, non-arc mode, property of 'Class' type
variety is treated as a 'void *'. No need to issue
warning reserved for objc object properties.
// rdar://10565506


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147504 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 00:31:53 +00:00
Eli Friedman 71523d6c41 Get rid of an unnecessary check; the AST for init-lists is the same independent of whether we're in C++11 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147503 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:54:05 +00:00
Ted Kremenek c1275da4eb Enhance UnixAPIChecker to also warn about zero-sized allocations to calloc() and realloc(). Patch by Cyril Roelandt!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147500 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:43:13 +00:00
Douglas Gregor 3f26e0fdcd Minor tweak to name lookup for C/Objective-C: after the first name, still consider whether this is a redeclaration lookup when determining whether to look for the visible declaration
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147499 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:34:23 +00:00
Douglas Gregor 7a537404f0 Test "merging" of typedef types across distinct modules. At present,
the AST reader doesn't actually perform a merge, because name lookup
knows how to merge identical typedefs together.

As part of this, teach C/Objective-C name lookup to return multiple
results in all cases, rather than first digging through the attributes
to see if the value is overloadable. This way, we'll catch ambiguous
lookups in C/Objective-C.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147498 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:26:26 +00:00
Eli Friedman 3edd5a9933 Support constant evaluation for OpenCL nested vector literals. Patch by Anton Lokhmotov.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147496 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:24:20 +00:00
Ted Kremenek de9f25365c Add initial version of checker to check if virtual member functions are called transitively
from C++ constructors or destructors.  Checker by Lei Zhang with a few tweaks by Ted Kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147494 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:18:57 +00:00
David Chisnall 78c6fcf819 Initialise constant Objective-C string isa pointers with a weak reference to the class, so that they are usable in +load methods if the string class has been compiled with clang - if it's been compiled with GCC, the ABI makes this impossible. (GNU runtimes)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147493 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 23:18:17 +00:00
Fariborz Jahanian 341b8be2b8 objc: diagnose misplacement of objc_suppress_autosynthesis
attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147490 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 22:52:32 +00:00
Chad Rosier ed002bd2f9 Fixed by Chandler in r147434.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147489 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 22:51:32 +00:00
Douglas Gregor 1ca4a5c41b Implement cross-module declaration merging for tag declarations, so
that if two modules A and B both contain a declaration of a tag such
as

  struct X;

and those two modules are unrelated, the two declarations of X will be
merged into a single redeclaration chain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147488 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 22:46:00 +00:00
Douglas Gregor 7fde651893 Add __has_feature(objc_modules)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147482 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 21:12:26 +00:00
Douglas Gregor 1ac13c37d8 Re-uglify #public and #private to #__public_macro and #__private_macro.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147469 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 19:48:16 +00:00
Fariborz Jahanian eb4f2c56c2 objc: use objc_suppress_autosynthesis attribute on classes
which should not be default synthesized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147468 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 19:46:00 +00:00
Douglas Gregor c13a34b690 Eliminate the uglified keyword __import_module__ for importing
modules. This leaves us without an explicit syntax for importing
modules in C/C++, because such a syntax needs to be discussed
first. In Objective-C/Objective-C++, the @import syntax is used to
import modules.

Note that, under -fmodules, C/C++ programs can import modules via the
#include mechanism when a module map is in place for that header. This
allows us to work with modules in C/C++ without committing to a syntax.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147467 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 19:32:59 +00:00
Joerg Sonnenberger f84d560fc7 Don't depend on undefined macros being 0, there are options for the
preprocessor to warn about it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147466 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 19:22:38 +00:00
Fariborz Jahanian e23dcf3524 objc: introduce objc_suppress_autosynthesis class
attributes for later use.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147457 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 18:45:41 +00:00
Douglas Gregor 94ad28b314 Under -fmodules, accept #public <macroname> and #private <macroname>
to make a macro public (the default for headers) or private,
respectively.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147455 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 18:24:14 +00:00
Douglas Gregor 5948ae1021 Introduce a non-uglified syntax for module imports in Objective-C:
@import identifier [. identifier]* ;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 18:04:46 +00:00
Douglas Gregor 674949fe3f Don't attempt to merge a deserialized declaration with existing
declarations in the AST unless modules are enabled. This case doesn't
come up with precompiled headers, and it isn't cheap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147451 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 17:31:38 +00:00
Douglas Gregor dea22cc576 Factor the merging of declarations in the AST reader out to a separate
member function template, since the behavior is identical for
ObjCInterfaceDecl and ObjCProtocolDecl. It's expected that all
redeclarable entities will have the same behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147450 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 17:27:13 +00:00
Douglas Gregor 7025d2cc32 Add -fno-modules to the driver, to turn off modules (although they're off by default anyway).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147449 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 17:13:05 +00:00
Douglas Gregor 752c74d99b Add a "Modules" language option, which subsumes the previous
"AutoModuleImport" preprocessor option and is tied to -fmodules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147448 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 17:07:34 +00:00
Douglas Gregor c514a8a0ea Rename the command-line option for mapping #include/#import over to
module imports from -fauto-module-import to -fmodules. The new name
will eventually be used to enable modules, and the #include/#import
mapping is a crucial part of the feature.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147447 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 15:21:29 +00:00
Rafael Espindola 0257b7fbbe Process attributes in explicit template instatiation definitions. Fixes PR11690.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 06:04:21 +00:00
Chandler Carruth ba9186c6fc Teach the frontend to provide the builtin preprocessor defines for
-ffast-math.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147440 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 02:46:46 +00:00
Richard Smith a2d8669b09 Add assertion to char32_t that the value is valid, as suggested by Jordy Rose.
Add a test that such characters don't make it through to StringLiteral objects
in error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147438 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 18:14:06 +00:00
Douglas Gregor d07cc36c71 Diagnose cases where the definition of a particular type is required,
is known (to Clang), but is not visible because the module has not yet
been imported.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147436 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 17:18:37 +00:00
Chandler Carruth abf07a7fb6 Fix PR11685 by implementing -ffast-math and its various friends in the
Clang driver. This involves a bunch of silly option parsing code to try
to carefully emulate GCC's options. Currently, this takes a conservative
approach, and unless all of the unsafe optimizations are enabled, none
of them are. The fine grained control doesn't seem particularly useful.
If it ever becomes useful, we can add that to LLVM first, and then
expose it here.

This also fixes a few tiny bugs in the flag management around
-fhonor-infinities and -fhonor-nans; the flags now form proper sets both
for enabling and disabling, with the last flag winning.

I've also implemented a moderately terrifying GCC feature where
a language change is also provided by the '-ffast-math' flag by defining
the __FAST_MATH__ preprocessor macro. This feature is tracked and
serialized in the frontend but it isn't used yet. A subsequent patch
will add the preprocessor macro and tests for it.

I've manually tested that codegen appears to respect this, but I've not
dug in enough to see if there is an easy way to test codegen options w/o
relying on the particulars of LLVM's optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147434 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 14:19:45 +00:00
Abramo Bagnara 1e8a0678df Added a missing case for -Wdisabled-macro-expansion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147433 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 10:08:26 +00:00
Rafael Espindola b5d763d87c Small cosmetic cleanups in code I will change anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147424 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 06:26:22 +00:00
Douglas Gregor a28cb3ee88 Eliminate ObjCProtocolDecl's end-of-definition location. It is not
used anywhere.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 02:22:52 +00:00
Douglas Gregor 61cc296de6 Fix canonicalization of protocol-qualified types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147421 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 02:00:30 +00:00
Douglas Gregor ec1a58b201 Move ObjCProtocolDecl::EndLoc into its DefinitionData, and give
ObjCProtocolDecl proper source-range information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147420 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 01:18:16 +00:00
Douglas Gregor c9d3c7edb5 Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. They are no longer needed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147419 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 22:06:18 +00:00
Abramo Bagnara 163ada8a0f Added -Wdisabled-macro-expansion warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147418 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 22:01:04 +00:00
Douglas Gregor dba9361891 Implement declaration merging for Objective-C protocols across
multiple, disjoint modules. There is far too much duplicating with the
ObjCInterfaceDecl case here, which I'll eliminate shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147417 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 21:47:52 +00:00
Douglas Gregor 49310ba7dc Eliminate redundant, empty function
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147416 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 21:39:12 +00:00
Douglas Gregor bd9482d859 Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147415 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 21:23:57 +00:00
Douglas Gregor a6387f3b44 Don't bother rewriting an Objective-C class or protocol declaration to the module file when we've merely added a definition
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147414 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 20:35:33 +00:00
Douglas Gregor 3937f87e53 Eliminate ASTMutationListener::UpdatedAttributeList, which is no
longer needed now that we aren't back-patching ObjCProtocolDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147413 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 20:33:24 +00:00
Douglas Gregor 27c6da284f Wire up redeclaration chains for Objective-C protocols, so that both
forward declarations and definitions of an Objective-C protocol are
represented within a single chain of ObjCProtocolDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147412 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 20:30:41 +00:00
Douglas Gregor 1d784b277c Introduce the core infrastructure needed to model redeclaration chains
for Objective-C protocols, including:
  - Using the first declaration as the canonical declaration
  - Using the definition as the primary DeclContext
  - Making sure that all declarations have a pointer to the definition
  data, and that we know which declaration is the definition
  - Serialization support for redeclaration chains and for adding
  definitions to already-serialized declarations.

However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCProtocolDecls.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 19:51:50 +00:00
Douglas Gregor 5e2a1ff9f2 Move the data that corresponds to the definition of a protocol into a
separately-allocated DefinitionData structure. Introduce various
functions that will help with the separation of declarations from
definitions (isThisDeclarationADefinition(), hasDefinition(),
getDefinition()).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 19:29:29 +00:00
Rafael Espindola 27b7ce6199 Use hasSameType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 18:36:59 +00:00
Douglas Gregor 3fc73ee0c6 Use declaresSameEntity() when comparing ObjCProtocolDecls, and
getCanonicalDecl() when putting ObjCProtocolDecls into a set. This is
groundwork for making ObjCProtocolDecl redeclarable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147406 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 18:09:12 +00:00
Rafael Espindola 71cb8a2e10 Consider visibility attributes in namespaces as being explicit. I.e., they
take precedence over command line options. Fixes PR10113.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147405 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 18:06:40 +00:00
Rafael Espindola 6f26b5eeb4 Replace a isa+cast with a dyn_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147401 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 17:48:19 +00:00
Douglas Gregor 51f564f80d Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows
mixed-language modules, where certain headers only work under some
language variants (e.g., in C++, std.tuple might only be available in
C++11 mode).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147387 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-31 04:05:44 +00:00
Richard Smith 4debc82d9d Fix crash when trying to pretty-print unicode or wide string literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147385 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 23:37:31 +00:00
Richard Smith 5120188238 Unrevert r147271, reverted in r147361.
Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.

Original comment from r147271:

constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147384 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 21:15:51 +00:00
NAKAMURA Takumi 5c76db3a4c clang/lib/Headers/CMakeLists.txt: Unbreak cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147373 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 10:38:16 +00:00
Craig Topper 7feb321af4 Add FMA4 intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147372 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 09:15:03 +00:00
Craig Topper f9322a6708 Remove an accidental change from r147370. Would only break if the new fma4 flag was used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147371 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 07:35:49 +00:00
Craig Topper 6a511e1407 Add FMA4 feature flag. Intrinsics coming soon. Also make sse4a feature flag imply sse3. Matches gcc behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 07:33:42 +00:00
Rafael Espindola f8c2a33b6e Revert r147271. This fixes PR11676.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147362 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-30 03:11:50 +00:00
Richard Smith d7c56e1114 Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147357 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 21:57:33 +00:00
Richard Smith 0945f20f1c Unbreak cmake build after r147340.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147355 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 21:42:29 +00:00
Craig Topper e14e08b255 Add popcnt feature flag to match gcc. This flag is implied when sse42 is enabled, but can be disabled separately. Move popcnt intrinsics to popcntintrin.h to match gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147340 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 16:10:46 +00:00
Rafael Espindola 63d32bdf89 Fix cmake build with -DBUILD_SHARED_LIBS=ON.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147338 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 04:31:59 +00:00
DeLesley Hutchins df49782c54 Support for thread safety attributes on functions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147331 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 00:56:48 +00:00
Richard Smith 80d4b55db9 Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147318 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 19:48:30 +00:00
Rafael Espindola 0e743b1582 Handle a /etc/debian_version with a version number instead of a codename.
Patch by Sylvestre Ledru. Fixes PR11673.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147313 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 18:17:14 +00:00
Benjamin Kramer b406669fea Add a target hook for FLT_EVAL_METHOD and use it to set the value on x86 with sse disabled.
x87 math evaluates everything with 80 bits precision, so we have to set FLT_EVAL_METHOD
to "2".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 15:47:06 +00:00
Hans Wennborg 5294c792c7 Support the 'a' scanf length modifier as an extension in C++.
It should not be supported in C++11, since that uses the C99 standard
library, in which 'a' is a format specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147310 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 13:10:50 +00:00
Zhongxing Xu 72b20ff76a Enable the user to control whether CXXConstructExpr will be added as a
block-level expr. Currently CXXConstructExpr is always added as a block-level
expr. This caused two problems for the analyzer (and potentially for the
CFG-based codegen).
1. We have no way to know whether a ctor call is base or complete.
2. We have no way to know the destination object being contructed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147306 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 04:38:46 +00:00
Douglas Gregor 375bb1413c Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147299 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-27 22:43:10 +00:00
Rafael Espindola fedb6ecbed Fix the visibility of methods of explicit template instantiation definition
when using -fvisibility-inlines-hidden. This matches gcc's behavior and
documentation.

Fixes PR11642.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-27 21:15:28 +00:00
Richard Smith 47d2145675 constexpr: support for evaluation and codegen of typeid constants.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147290 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-27 12:18:28 +00:00
Benjamin Kramer 4a08268a69 Initialize member that ends up in PCH files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-27 11:15:04 +00:00
Eli Friedman fb8c56d604 Partially revert r147195; lib/Basic/Version.cpp conditionally depends on config.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147282 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-26 22:43:17 +00:00