[libclang] For getDeclFromExpr in CIndex.cpp, associate the decl of
a DeclRefExpr, MemberExpr, etc. with a CastExpr if it is ImplicitCast,
since the implicit cast is the one that is invisible in source code.
Douglas Gregor [Mon, 12 Sep 2011 20:41:59 +0000 (20:41 +0000)]
Introduce a cc1-level option to provide the path to the module cache,
where the compiler will look for module files. Eliminates the
egregious hack where we looked into the header search paths for
modules.
[libclang] In ASTUnit::Parse copy the CompilerInvocation object instead of
modifying directly for the preamble.
This avoids an awful, hard to find, bug where "PreprocessorOpts.DisablePCHValidation = true"
would be persistent for subsequent reparses of the translation unit which would result
in defines, present in command-line but not in the PCH, being ignored.
[libclang] Make c-index-test check CINDEXTEST_REMAP_AFTER_TRIAL environment variable,
which when set it determines the trial number after which the remapping of files should
take effect.
Anna Zaks [Mon, 12 Sep 2011 17:56:08 +0000 (17:56 +0000)]
[analyzer] Fix a new failure encountered while building Adium exposed as a result of r138196(radar://10087620). ObjectiveC property of type int has a value of type ObjCPropRef, which is a Loc.
Douglas Gregor [Mon, 12 Sep 2011 15:48:15 +0000 (15:48 +0000)]
Remove the restriction on module-private friends. Since the friend
declaration may be the first declaration, we want the ability to that
declaration to be marked module-private.
Douglas Gregor [Mon, 12 Sep 2011 15:17:19 +0000 (15:17 +0000)]
Only predefine the __EXCEPTIONS macro if C++ exceptions are turned on.
Only predefine the OBJC_ZEROCOST_EXCEPTIONS macro if Objective-C
exceptions are turned on. Fixes PR10910.
objc rewriter - more fixes to support compiling the rewritten
test case having instancetype. Fix in rewriter is unrelated to
using of instancetype. Test case uses other feature not yet
supported in the rewriter. There is more work to do, but this
is an ongoing task and not urgent at this time.
John McCall [Sat, 10 Sep 2011 09:17:20 +0000 (09:17 +0000)]
Simplify the generation of Objective-C setters, at least a little.
Use a more portable heuristic for deciding when to emit a single
atomic store; it's possible that I've lost information here, but
I'm not sure how much of the logic before was intentionally arch-specific
and how much was just not quite consistent.
Richard Trieu [Sat, 10 Sep 2011 01:56:32 +0000 (01:56 +0000)]
Revision 139454 fixed a broken assert in LLVM, which causes
a test failure in CodeGen/palignr.c, which has been marked
XFAIL for the time being. A bug has been filed at PR10901
for this issue.
John McCall [Sat, 10 Sep 2011 01:16:55 +0000 (01:16 +0000)]
When converting a block pointer to an Objective-C pointer type, extend
the lifetime of the block by copying it to the heap, or else we'll get
a dangling reference because the code working with the non-block-typed
object will not know it needs to copy.
There is some danger here, e.g. with assigning a block literal to an
unsafe variable, but, well, it's an unsafe variable.
Douglas Gregor [Sat, 10 Sep 2011 00:56:20 +0000 (00:56 +0000)]
Fix a diagnostics crasher with -Wmissing-noreturn in Objective-C
methods, and improve the diagnostic slightly along the way. Fixes
<rdar://problem/10098695>.
Douglas Gregor [Sat, 10 Sep 2011 00:22:34 +0000 (00:22 +0000)]
Clean up our handling of Objective-C definitions in AST files. Rather
than having CodeGen check whether a declaration comes from an AST file
(which it shouldn't know or care about), make sure that the AST writer and
reader pass along "interesting" declarations that CodeGen needs to
know about.
Extend the Stmt AST to make it easier to look through label, default,
and case statements. Use this to make the logic in the CFG builder more
robust at finding the actual statements within a compound statement,
even when there are many layers of labels obscuring it.
Also extend the test cases for a large chunk of PR10063. Still more work
to do here though.
Douglas Gregor [Fri, 9 Sep 2011 23:01:35 +0000 (23:01 +0000)]
Introduce a new predicate Decl::isFromASTFile() to determine whether a
declaration was deserialized from an AST file. Use this instead of
Decl::getPCHLevel() wherever possible. This is a simple step toward
killing off Decl::getPCHLevel().
Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.
Douglas Gregor [Fri, 9 Sep 2011 22:02:16 +0000 (22:02 +0000)]
In the ASTReader, replace the never-NULL Preprocessor pointer with a
Preprocessor reference. Simplify some code along the way, so there is
no separate "initialize the preprocessor" step.
Douglas Gregor [Fri, 9 Sep 2011 21:34:22 +0000 (21:34 +0000)]
In ASTReader, replace the never-NULL ASTContext pointer with an
ASTContext reference. Remove all of the extra checking and logic that
was used to cope with a NULL ASTContext. No effective functionality
change.
Douglas Gregor [Fri, 9 Sep 2011 21:05:56 +0000 (21:05 +0000)]
Back out r139358 "[PCH] When loading the decls linked to an
identifier, also make them visible in the translation unit," which
isn't needed now that John's eliminated the AST dependency in blocks
CodeGen.
John McCall [Fri, 9 Sep 2011 20:41:01 +0000 (20:41 +0000)]
Treat the weak export of block runtime symbols as a deployment-target
feature akin to the ARC runtime checks. Removes a terrible hack where
IR gen needed to find the declarations of those symbols in the translation
unit.
objc rewriter - Add rewriter test for new instancetype
along with minor rewriter fix to handle that. This
test is still incomplete due to rewriter issues
unrelated to instancetype.
Anna Zaks [Fri, 9 Sep 2011 18:43:53 +0000 (18:43 +0000)]
[analyzer] When running scan-build with -plist on ./configure, delete the plist files.
(scan-build does not set the $HtmlDir when running against configure. Previously, this implied that the plist files would appear in the current directory, with this patch they will get deleted.)
Douglas Gregor [Fri, 9 Sep 2011 16:51:10 +0000 (16:51 +0000)]
When type-checking a call to an overloaded, builtin atomic operation,
construct a new DeclRefExpr rather than re-using the existing
DeclRefExpr. Patch by Likai Liu, fixes PR8345.
Thread safety: This patch deals with previously unhandled cases when building lock expressions. We now resolve this expressions, avoid crashing when encountering cast expressions, and have a diagnostic for unresolved lock expressions
John McCall [Fri, 9 Sep 2011 07:56:05 +0000 (07:56 +0000)]
Clean up the sentinel-attribute checking code a lot. Document
what 'nullPos' is supposed to mean, at least at this one site.
Use closed forms for the arithmetic. Rip out some clever but
ultimately pointless code that was trying to use 0 or 0L depending
the size of a pointer vs. the size of int; first, it didn't work
on LLP64 systems, and second, the sentinel checking code requires
a pointer-typed value anyway, so this fixit would not have actually
removed the warning.
Do a lookup for the blocks runtime globals to see if they were declared,
instead of codegen waiting to consume such a declaration, which won't
happen if that decls are coming from a PCH.
John McCall [Fri, 9 Sep 2011 06:11:02 +0000 (06:11 +0000)]
Contextually converting to 'id' is not a useful operation. Contextually
converting to an arbitrary Objective-C pointer type is. Without
significantly re-implementing anything, change the API to reflect this,
and as a minor optimization, strip the pointer conversion off before
potentially building it.
Mostly, this removes a really bizarre-looking bit of code from
BuildInstanceMessage.
John McCall [Fri, 9 Sep 2011 05:25:32 +0000 (05:25 +0000)]
Give conversions of block pointers to ObjC pointers a different cast kind
than conversions of C pointers to ObjC pointers. In order to ensure that
we've caught every case, add asserts to CastExpr that strictly determine
which cast kind is used for which kind of bit cast.
Richard Trieu [Fri, 9 Sep 2011 03:59:41 +0000 (03:59 +0000)]
Clean up the RebuildUnknownAnyExpr visitor in SemaExpr.cpp. Mainly swapped around variable names so that this visitor be more like other visitors in clang.
Richard Trieu [Fri, 9 Sep 2011 03:18:59 +0000 (03:18 +0000)]
Changed references of BaseTy, MemInitTy, CXXScopeTy, TemplateParamsTy to CXXBaseSpecifier, CXXCtorInitializer, NestedNameSpecifier, TemplateParameterList and removed their typedefs.
Douglas Gregor [Fri, 9 Sep 2011 02:06:17 +0000 (02:06 +0000)]
Modules: introduce the __module_private__ declaration specifier, which
indicates that a declaration is only visible within the module it is
declared in.
Richard Trieu [Fri, 9 Sep 2011 01:45:06 +0000 (01:45 +0000)]
Capitialize paramater names in SemaExpr.cpp and resolve any parameter name conflicts between declarations and definitions from this and previous refactorings.
Thread Safety: In C++0x Mutexes are the objects that control access to shared variables, while Locks are the objects that acquire and release Mutexes. We switch to this new terminology.
The frexp, modf, and remquo builtins are not 'const'.
These functions return a second value by writing to a pointer argument,
so they cannot be marked 'readnone' which implies that they don't access
memory.