Commit Graph

966 Commits

Author SHA1 Message Date
Sebastian Redl 6f28289aca Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.
llvm-svn: 59057
2008-11-11 17:56:53 +00:00
Daniel Dunbar a94d873b4b Move backend output out of destructor.
Don't free AST consumer when --disable-free is set.

llvm-svn: 59030
2008-11-11 06:35:39 +00:00
Daniel Dunbar c92892d9cc Remove unused function declaration.
llvm-svn: 59024
2008-11-11 04:48:20 +00:00
Argyrios Kyrtzidis 32a0379575 Implement support for C++ nested-name-specifiers ('foo::bar::x') in the Parser side.
No Sema functionality change, just the signatures of the Action/Sema methods.

llvm-svn: 58913
2008-11-08 16:45:02 +00:00
Ted Kremenek 3391cb00fc Patch by Nikita Zhuk: Add TranslationUnitActions to AnalysisConsumer.
llvm-svn: 58831
2008-11-07 02:09:25 +00:00
Douglas Gregor 7d5fc7e28b Initial, rudimentary implementation of operator overloading for binary
operators. For example, one can now write "x + y" where x or y is a
class or enumeration type, and Clang will perform overload resolution
for "+" based on the overloaded operators it finds.

The other kinds of overloadable operators in C++ will follow this same
approach. 

Three major issues remain:
  1) We don't find member operators
  2) Since we don't have user-defined conversion operators, we can't
  call any of the built-in overloaded operators in C++ [over.built].
  3) Once we've done the semantic checks, we drop the overloaded
  operator on the floor; it doesn't get into the AST at all.

llvm-svn: 58821
2008-11-06 23:29:22 +00:00
Ted Kremenek b4ebbc5a86 AnalysisManager can now be used to for analyses over TranslationUnits.
llvm-svn: 58766
2008-11-05 19:05:06 +00:00
Douglas Gregor 8ea1f53420 Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr
llvm-svn: 58698
2008-11-04 14:56:14 +00:00
Steve Naroff c989a7b6c0 Fix <rdar://problem/6339636> clang ObjC rewriter: Assertion failed: FileID-1 < FileIDs.size() && "Invalid FileID!", file c:\cygwin\home\Administrator\llvm\tools\clang\include\clang/Basic/SourceManager.h, line 513
llvm-svn: 58654
2008-11-03 23:29:32 +00:00
Ted Kremenek 14f18653f6 Hook up the Plist diagnostic client to the driver.
Fix Plist output.

llvm-svn: 58652
2008-11-03 23:18:07 +00:00
Ted Kremenek e868c00d5a Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
llvm-svn: 58646
2008-11-03 22:31:48 +00:00
Steve Naroff 3e7ced125b Fix <rdar://problem/6336774> clang block rewriter: Assertion failed: Offset+NumBytes <= size() && "Invalid region to erase!", file c:\cygwin\home\Administrator\llvm\to ols\clang\include\clang/Rewrite/RewriteRope.h, line 219.
llvm-svn: 58607
2008-11-03 11:20:24 +00:00
Daniel Dunbar ada702ef45 Turn off module verification in Release-Asserts builds.
llvm-svn: 58500
2008-10-31 09:34:21 +00:00
Daniel Dunbar f8362f9e5d "One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
 - Other lines are just because MinimalAction didn't have access to
   the LangOptions.

llvm-svn: 58498
2008-10-31 08:56:51 +00:00
Steve Naroff 44df6a205b Make sure RewriteObjCMethodDecl() does a block pointer rewrite.
llvm-svn: 58430
2008-10-30 14:45:29 +00:00
Steve Naroff 295570a126 Add a couple fixes for rewriting ivars/methods that use/contain blocks.
Now this:

@interface Test
{
  void (^ivar)(void);
}
- (void)name;
@end

@implementation Test
- (void)name {
  ivar = ^{ printf("hello\n"); }; // ((struct Test_IMPL *)self)->ivar = (void (*)(void))&__name_block_impl_0((void *)__name_block_func_0);
  ivar(); // ((void (*)(struct __block_impl *))((struct __block_impl *)((struct Test_IMPL *)self)->ivar)->FuncPtr)((struct __block_impl *)((struct Test_IMPL *)self)->ivar); 
}

llvm-svn: 58428
2008-10-30 12:09:33 +00:00
Steve Naroff 350b665610 Convert SynthesizeBlockCall() from test->AST based implementation.
llvm-svn: 58427
2008-10-30 10:07:53 +00:00
Zhongxing Xu 9655394b6e Adjust code format.
llvm-svn: 58420
2008-10-30 05:03:28 +00:00
Steve Naroff e25142302e Convert SynthBlockInitExpr() from text->AST based implementation.
llvm-svn: 58396
2008-10-29 21:23:59 +00:00
Steve Naroff d8907b7bea Handle block literals at file scope, remove some dead code, etc.
llvm-svn: 58390
2008-10-29 18:15:37 +00:00
Steve Naroff 52c65fa169 Make sure internally synthesized block pointer types are converted before pretty printing.
llvm-svn: 58380
2008-10-29 14:49:46 +00:00
Daniel Dunbar b3a36cf86a Workaround an LLVM bug where inlining functions with debug info breaks
code generation.
 - For now, disable running the always inliner pass (at -O0) if we are
   also generating debug information.

llvm-svn: 58376
2008-10-29 08:50:02 +00:00
Daniel Dunbar e74f2c2633 Improve llvm-gcc compatibility, -Os implies -O2 (sortof).
llvm-svn: 58374
2008-10-29 07:56:11 +00:00
Daniel Dunbar a3730a23a2 Choose CompileOptions (optimization passes) to match llvm-gcc more
closely.

llvm-svn: 58361
2008-10-29 03:42:18 +00:00
Chris Lattner 1500970962 .s files don't require the preprocessor, patch by Roman Divacky!
llvm-svn: 58349
2008-10-28 20:33:42 +00:00
Steve Naroff f4b992a8ec More changes necessary to integrate the objc and blocks rewriters.
With this commit, stuff like this is very close to working...

    [foo barf:^(int){ printf("whatever\n"); }];

Here is what is currently translates to...

    ((id (*)(id, SEL, void (^)(int)))(void *)objc_msgSend)((id)foo, sel_registerName("barf:"), (void (*)(int))__main_block_func_0);

I just need make sure the funky cast on objc_msgSend() is converted from "void (^)(int)" to "void (*)(int)". Since the cast doesn't appear in the source code, it needs to be converted in RewriteObjC::SynthMessageExpr().

llvm-svn: 58348
2008-10-28 20:29:00 +00:00
Daniel Dunbar d745976d36 Access pass manager consistently.
- No functionality change.

llvm-svn: 58342
2008-10-28 19:23:05 +00:00
Douglas Gregor f19b2319c9 Rename ExplicitCCastExpr to CStyleCastExpr
llvm-svn: 58331
2008-10-28 15:36:24 +00:00
Daniel Dunbar 460f8ee507 Call llvm_shutdown() on (normal) termination. This makes --time-passes usable.
llvm-svn: 58308
2008-10-28 00:38:08 +00:00
Daniel Dunbar 1a0625e5cf With -verify, only exit early on failure.
- Nice if -verify test exercise the various cleanup functions.

llvm-svn: 58285
2008-10-27 22:10:13 +00:00
Daniel Dunbar eb3e41417d Remove unneeded CheckASTConsumer function.
- No functionality change.

llvm-svn: 58282
2008-10-27 22:03:52 +00:00
Steve Naroff b88d775201 Fix testsuite regression for "crash.m".
llvm-svn: 58269
2008-10-27 20:54:44 +00:00
Daniel Dunbar 9b87dcb929 Don't double free module when IRgen fails.
llvm-svn: 58266
2008-10-27 20:40:41 +00:00
Daniel Dunbar 966c2e1454 Improve dependency file support.
- Add support for -MP (phony targets).
 
 - Use raw_ostream for output instead of std::string concatenation.
 
 - Break long lines in a GCC (4.2) compatible manner.

 - Output dependents in #included order (to match GCC).

llvm-svn: 58265
2008-10-27 20:01:06 +00:00
Douglas Gregor e200adc503 Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
  - ImplicitCastExpr is (still) used for all explicit casts
  - ExplicitCastExpr is now the root of all *explicit* casts
  - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
  - CXXFunctionalCastExpr inherits from ExplicitCastExpr
  - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
    of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
  - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, 
    CXXReinterpretCastExpr, and CXXConstCastExpr to 

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.

llvm-svn: 58264
2008-10-27 19:41:14 +00:00
Steve Naroff cb04e88580 Some fixups to the previous objc/blocks rewriter smerge.
llvm-svn: 58262
2008-10-27 18:50:14 +00:00
Steve Naroff 677ab3ab45 Integrate the blocks and objc rewriters.
llvm-svn: 58253
2008-10-27 17:20:55 +00:00
Chris Lattner 66a740e66e Rename Characteristic_t to CharacteristicKind
llvm-svn: 58224
2008-10-27 01:19:25 +00:00
Chris Lattner 07d754acf1 Remember whether an initlist had a designator in the AST.
llvm-svn: 58218
2008-10-26 23:43:26 +00:00
Chris Lattner 248388e313 pass designators into sema. This completes parser-level designator
support as far as I know.

llvm-svn: 58217
2008-10-26 23:35:51 +00:00
Sebastian Redl 5cba81afb3 Allow \n for newlines in expected error messages.
llvm-svn: 58198
2008-10-26 19:05:16 +00:00
Argyrios Kyrtzidis 22a3735398 Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.

llvm-svn: 58187
2008-10-26 16:43:14 +00:00
Oscar Fuentes 07d9f9a6ec CMake: Builds and installs clang binary and libs (no docs yet). It
must be under the `tools' subdirectory of the LLVM *source* tree.

llvm-svn: 58180
2008-10-26 00:56:18 +00:00
Ted Kremenek 3773bbce54 Use string literal for format string specifier; this prevents ErrMsg from being interpretted as a format string specifier.
llvm-svn: 58150
2008-10-25 20:19:34 +00:00
Nuno Lopes 36a04c8268 2nd try to fix leakage of the module provider. note that moduleprovider takes ownership of the module
llvm-svn: 58128
2008-10-24 23:27:18 +00:00
Nuno Lopes a39a4cec35 fix leaking of the module provider
llvm-svn: 58127
2008-10-24 22:51:00 +00:00
Daniel Dunbar fa0caca6d2 Add initial dependency file generation support. Patch by Kovarththanan
Rajaratnam, with some updates and formatting changes.

llvm-svn: 58122
2008-10-24 22:12:41 +00:00
Douglas Gregor 3dfef1f2a3 Move viewInheritance to CXXRecordDecl, and make sure it builds in Release mode, too
llvm-svn: 58105
2008-10-24 19:53:54 +00:00
Daniel Dunbar d3963f7f25 Use LINK_COMPONENTS instead of hard coding LLVM libraries.
llvm-svn: 58076
2008-10-24 06:24:13 +00:00
Zhongxing Xu c156be31a6 Fix linking error.
llvm-svn: 58067
2008-10-24 02:03:36 +00:00