That depends however on either mingw or msvc being installed, and
chapuni tells me there might be issues with float.h on mingw, so
no automated test is added.
Chad Rosier [Tue, 24 Apr 2012 22:40:01 +0000 (22:40 +0000)]
Add atan, atan2, exp, and log to the builtin math library functions.
With -fno-math-errno (the default for Darwin) or -ffast-math these library
function can be marked readnone enabling more opportunities for CSE and other
optimizations.
rdar://11251464
Richard Smith [Tue, 24 Apr 2012 20:39:49 +0000 (20:39 +0000)]
RecursiveASTVisitor: Visit instantiations of member templates of class
templates. In an implicit instantiation of a member class, any member
templates don't get instantiated, so the existing check which only visited
the instantiations of a defined template skipped these templates'
instantiations.
Since there is only a single declaration of a member template of a class
template specialization, just use that to determine whether to visit the
instantiations. This introduces a slight inconsistency in that we will
visit the instantiations of such templates whether or not they are
defined, but we never visit a declared-but-not-defined instantiation, so
this turns out to not matter.
Rafael Espindola [Sun, 22 Apr 2012 22:31:25 +0000 (22:31 +0000)]
Add a testcase that we already get right but was not being tested. Found
by a chrome build on OS X. Thanks to Nico Weber for testing a patch and
providing the .ii file.
Richard Smith [Sun, 22 Apr 2012 05:51:36 +0000 (05:51 +0000)]
PR12571: Objects of type clang::ConstantArrayType aren't always emitted with
type llvm::ArrayType -- sometimes we emit them as packed structs. Don't assert
if such a global array has an element type with a non-trivial destructor.
Richard Smith [Sun, 22 Apr 2012 02:13:50 +0000 (02:13 +0000)]
PR12585: When processing a friend template inside a class template, don't
pretend there was no previous declaration -- that can lead us to injecting
a class template (with no access specifier) into a class scope. Instead,
just avoid the problematic checks.
Richard Smith [Sat, 21 Apr 2012 18:42:51 +0000 (18:42 +0000)]
Fix regression in r154844. If necessary, defer computing adjusted destructor
exception specifications in C++11 until after we've parsed the exception
specifications for nested classes.
Richard Smith [Sat, 21 Apr 2012 01:27:54 +0000 (01:27 +0000)]
When declaring a template, check that the context doesn't already contain a
declaration of the same name. r155187 caused us to miss this if the prior
declaration did not declare a type.
Set the source location for the "member reference base type ... is not a
structure or union" diag to point at the operator rather than the member name.
If we're giving this diagnostic because of a typo'd '.' in place of a ';' at
the end of a line, the caret previously pointed at the identifier on the
following line, which isn't as helpful as it could be. Pointing the caret at
the '.' makes it more obvious what the problem is.
[libclang] Don't set dylib load address to 0xe000000.
Per Greg Clayton:
libclang.dylib is trying to be smart and load itself at a valid address
to be able to load faster which would work for 32 bit systems,
bit won't make any difference on 64 bit systems.
It should either pick a better 64 bit address, or just let itself be loaded at zero.
objective-c arc: With currnt documentation,
objc_returns_inner_pointer attribute can be applied to
methods only. Diagnsose otherwise, instead of
crashing. // rdar://11253688
Anna Zaks [Fri, 20 Apr 2012 21:59:08 +0000 (21:59 +0000)]
[analyzer] Run remove dead bindings right before leaving a function.
This is needed to ensure that we always report issues in the correct
function. For example, leaks are identified when we call remove dead
bindings. In order to make sure we report a callee's leak in the callee,
we have to run the operation in the callee's context.
This change required quite a bit of infrastructure work since:
- We used to only run remove dead bindings before a given statement;
here we need to run it after the last statement in the function. For
this, we added additional Program Point and special mode in the
SymbolReaper to remove all symbols in context lower than the current
one.
- The call exit operation turned into a sequence of nodes, which are
now guarded by CallExitBegin and CallExitEnd nodes for clarity and
convenience.
Chad Rosier [Fri, 20 Apr 2012 20:05:08 +0000 (20:05 +0000)]
In r135308, -save-temps was modified to prevent a temporary file from
overwriting the input file. For example,
clang -c foo.s -o foo.o -save-temps
Unfortunately, the original patch didn't compare the paths of the input and
output files. Thus, something like the following would fail to create foo.s.
cd /tmp/obj
clang -c ../src/foo.s -o foo.o -save-temps
Richard Smith [Fri, 20 Apr 2012 18:46:14 +0000 (18:46 +0000)]
Fix bug where a class's (deleted) copy constructor would be implicitly given a
non-const reference parameter type if the class had any subobjects with deleted
copy constructors. This causes a rejects-valid if the class's copy constructor
is explicitly defaulted (as happens for some implementations of std::pair etc).
Richard Smith [Fri, 20 Apr 2012 07:12:26 +0000 (07:12 +0000)]
Replace r155185 with a better fix, which also addresses PR12557. When looking
up an elaborated type specifier in a friend declaration, only look for type
declarations, per [basic.lookup.elab]p2. If we know that the redeclaration
lookup for a friend class template in a dependent context finds a non-template,
don't delay the diagnostic to instantiation time.
Chad Rosier [Fri, 20 Apr 2012 00:30:04 +0000 (00:30 +0000)]
When generating the clang crash diagnostic script, strip out the -D, -F, and -I
flags. We have preprocessed source, so we don't need these.
No test case as it's fairly difficult to make the compiler crash on demand. I'll
patiently wait for Ben to tell me how to do this in 2 lines of code. :)
rdar://11283560
objective-arc: Retune my previous patch so warning
is issued on weak property as receiver and not on
any other use of a weak property. // rdar://10225276
Re-add the closing '}' for the namespace I accidentally deleted when
removing a (new) duplicate test whose only difference was the tag type
being an enum instead of a struct.
In Parser::isCXXDeclarationSpecifier, consider a non-type identifier
followed by an identifier as declaration specificer (except for ObjC).
This allows e.g. an out-of-line C++ member function definitions to be
recognized as functions and not as variable declarations if the type
name for the first parameter is not recognized as a type--say, when there
is a function name shadowing an enum type name and the parameter is
missing the "enum" keyword needed to distinguish the two.
Note that returning TPResult::Error() instead of TPResult::True()
appears to have the same end result, while TPResult::Ambiguous()
results in a crash.
Richard Smith [Thu, 19 Apr 2012 22:09:22 +0000 (22:09 +0000)]
In an attempt to reduce confusion, mark 'Strong compare exchange' as done, since
we generate correct code for both strong and weak atomic compare-exchanges, even
though we don't propagate to the IR enough information to generate optimal weak
compare-exchanges on architectures which support them.
Thread safety analysis: split warnings into two groups: attribute warnings
which are checked in the parser, and analysis warnings that require the
full analysis. This allows attribute syntax to be checked independently
of the full thread safety analysis. Also introduces a new warning for the
case where a string is used as a lock expression; this allows the analysis
to gracefully handle expressions that would otherwise cause a parse error.