accessed via the indirect pointer, they don't need to be pointers to pointers).
Finished moving the message lookup code into separate subclasses for each
runtime. Also performed a few smallish related tidies.
We're now bitcasting the result of the message lookup functions, rather than
casting the lookup functions themselves, so the messages.m test needed updating
to reflect this.
llvm-svn: 128180
that I hadn't used C++ for several years before writing most of this code).
Still lots more to do. This set of changes includes:
- Remove the distinction between typed and untyped selectors. More accurately
reflect what the runtime does, by using typed selectors everywhere, with an
empty type field if the types are unknown. Now we just store a small list of
types for each selector (in theory, this should always be exactly one, but
this constraint was not enforced back in 1986 when it should have been).
- Add some consistency to how runtime functions are created. These are all
generated via the LazyRuntimeFunction class (which might be useful outside
CGObjCGNU - feel free to move it into a header if it is). This function
stores the types of a function, looks it up the first time it's used, and
caches the result. This means that we're now not wasting time constructing
the llvm::FunctionType every time some of the functions are looked up, but
also not inserting references to runtime functions into the module if they're
not actually used.
- Started separating out the fragile and non-fragile ABI behaviours into two
subclasses of CGObjCGNU: CGObjCGCC for the legacy GCC runtime ABI and
CGObjCGNUstep for the new GNUstep ABI. Not all of the differences in
behaviour are factored out yet, but they will be in future commits.
- Removed all of the CodeGen:: things: we've been using namespace CodeGen in
this file for ages, so having explicit namespace specifiers is just a bit
confusing.
- Added a few more comments.
- Used llvm::StringRef instead of std::string in a few places.
- Finally got around to storing the module path in the module structure. The
ABI says that the compiler should do this, although it's not used in the
runtime or exposed outside the runtime, so it's pretty useless.
Still to do:
- We currently have two code paths for generating try blocks, one for ObjC and
one for ObjC++. Not only are these substantially similar, they are also very
similar to the CGObjCMac version. These need factoring out into a single
parameterised implementation, either in CGObjCRuntime or CodeGenFunction.
The EmitObjCXXTryStmt() function was added so that the changes to fix a bug
in time for the 2.9 release would be self-contained and reduce the chances of
breaking anything else, but these should be done properly as soon as
possible.
- Split up some large functions (e.g. GenerateClass()) into smaller functions
for generating the various data structures.
- The method lookup code into the two subclasses, removing the conditionals in
the message send functions.
- Add doxygen comments on the remaining undocumented functions.
- We seem to be generating global pointer variables for selectors, then storing
a pointer to the selector, then generating a load of this pointer (and then a
load of the real selector later) every time a static selector is used. I can
only assume I was asleep or drunk when I did this - we should just be
referencing the selectors directly in the selector array.
llvm-svn: 128152
string itself lives longer than the DelayedDiagnostic. Fixes a recent
use-after-free regression due to my availability attribute work.
llvm-svn: 128148
which versions of an OS provide a certain facility. For example,
void foo()
__attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));
says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:
- If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
will result in a deprecation warning, as if we had placed
attribute((deprecated)) on it (but with a better diagnostic)
- If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
will result in an "unavailable" warning (in C)/error (in C++), as
if we had placed attribute((unavailable)) on it
- If we choose a deployment target prior to 10.2, foo() is
weak-imported (if it is a kind of entity that can be weak
imported), as if we had placed the weak_import attribute on it.
Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.
The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.
Addresses <rdar://problem/6690412>.
As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.
llvm-svn: 128127
line options, instead of leveraging the blanket -mllvm option.
- This allows using the frontend itself without requiring the backend have
those options available (i.e., if the target wasn't built).
llvm-svn: 128087
they don't collide with file-scope extern functions from the same
translation unit. This is basically a matter of applying the same
logic to FunctionDecls as we were previously applying to VarDecls.
llvm-svn: 128072
This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct
ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance
object.
llvm-svn: 128011
program and fallback to plain version otherwise. Use this for the NetBSD
target to make it try e.g. i486--netbsdelf-as and -ld for target
i486--netbsdelf.
llvm-svn: 127996
This rename serves two purposes:
- It reflects the actual functionality of this analysis.
- We will have more than one reachability analysis.
llvm-svn: 127930
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers. Patch originally by ARM;
language-specific address space support by myself.
llvm-svn: 127915
- We don't really support the majority of the horrible -traditional-cpp
behavior, but it is unlikely that we ever will either. This allows us to
start trying to use clang as a /usr/bin/cpp replacement and see what pieces
of -traditional-cpp mode people actually care about.
llvm-svn: 127911
MSYS substitutes path (that begins with "/") to de-mounted Windows path, even if it were nonexistent.
"/foo/bar" might be substituted to "C:/msysgit/foo/bar".
llvm-svn: 127861
MSYS substitutes path (that begins with "/") to de-mounted Windows path.
"/tmp" might be substituted as "C:/DOCUME~1/chapuni/LOCALS~1/Temp".
llvm-svn: 127860
Issue this as an IR-gen error; it's not really worthwhile doing this
"right", i.e. in Sema, because IR gen knows a lot of tricks beyond
what the constant evaluator knows.
llvm-svn: 127854
walk the preprocessing record *before* walking the declarations, so
they we pretend that we actually respect the phases of translation.
We still walk the preprocessing record after the declarations when
performing token annotation or finding the cursor at a location, since
those routines depend on those semantics.
Fixes <rdar://problem/9137195>.
llvm-svn: 127776
the program name, if it includes it as proper prefix. This makes calling
clang with -ccc-host-triple x86_64-linux the same as calling it with the
name x86_64-linux-clang.
llvm-svn: 127753
Add 'openFile' bool to FileManager::getFile to specify whether we want to have the file opened or not, have it
false by default, and enable it only in HeaderSearch.cpp where the open+fstat optimization matters.
Fixes rdar://9139899.
llvm-svn: 127748
overload, so that we actually do the resolution for full expressions
and emit more consistent, useful diagnostics. Also fixes an IRGen
crasher, where Sema wouldn't diagnose a resolvable bound member
function template-id used in a full-expression (<rdar://problem/9108698>).
llvm-svn: 127747
clients to observe the exact path through which an #included file was
located. This is very useful when trying to record and replay inclusion
operations without it beind influenced by the aggressive caching done
inside the FileManager to avoid redundant system calls and filesystem
operations.
The work to compute and return this is only done in the presence of
callbacks, so it should have no effect on normal compilation.
Patch by Manuel Klimek.
llvm-svn: 127742
operands to a binary expression; it doesn't make sense in all
contexts. The right answer would be to see if the user forgot at ().
Fixes <rdar://problem/9136502>.
llvm-svn: 127740
ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that
we diagnose undefined labels before the jump-scope checker gets run,
since the jump-scope checker requires (as its invariant) that all of
the GotoStmts be wired up correctly.
Fixes PR9495.
llvm-svn: 127738
forward-looking "goto" statement, make sure to insert it *after* the
last declaration in the identifier resolver's declaration chain that
is either outside of the function/block/method's scope or that is
declared in that function/block/method's specific scope. Previously,
we could end up inserting the label ahead of declarations in inner
scopes, confusing C++ name lookup.
Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>.
Note that the crash-on-invalid PR9495 is *not* fixed. That's a
separate issue.
llvm-svn: 127737
Find out that our C++0x status has only one field for noexcept expression and specification together, and that it was accidentally already marked as fully implemented.
This completes noexcept specification work.
llvm-svn: 127701