Commit Graph

14118 Commits

Author SHA1 Message Date
Daniel Dunbar aea0620b89 Driver: Change Option parsing to always create arguments referring to unaliased
options.
 - This matches the intent of the .td files, and will simplify alias handling.
 - PR7321.

llvm-svn: 105744
2010-06-09 19:19:01 +00:00
Daniel Dunbar 26a95c6717 Driver: Add an explicit offset to JoinedArg and JoinedAndSeparateArg, so that
they can be independent of the exact option that created them.

llvm-svn: 105739
2010-06-09 18:49:38 +00:00
Daniel Dunbar d96e279f02 Driver: Change Arg::render methods to use option name instead of string where
possible.

llvm-svn: 105738
2010-06-09 18:49:31 +00:00
Nate Begeman d90aa43bdf Implement codegen for hadd, hsub, max, min, mlal, movl, movn, padal, mov_n
Make note about how to handle the dozen or so multiply by scalar ops.

llvm-svn: 105734
2010-06-09 18:04:15 +00:00
Abramo Bagnara 656e300f03 Added inherited info to template and non-type arguments of templates.
llvm-svn: 105716
2010-06-09 09:26:05 +00:00
Chandler Carruth af80f66997 Major redesign of the RecursiveASTVisitor. This implements the majority of the
new design discussed on cfe-dev, with further steps in that direction to come.
It is already much more complete than the previous visitor.

Patch by Zhanyong and Craig with 80 column wraps and one missing declaration
added by me.

llvm-svn: 105709
2010-06-09 08:17:30 +00:00
Chandler Carruth b52b9100bf Remove an entry for a now deleted file. Fixes the neglected CMake build. ;]
llvm-svn: 105708
2010-06-09 08:12:12 +00:00
John McCall a5dd326ca5 Correctly handle > 257 substitutions in a single mangling, and don't introduce
a spurious substitution for an unscoped dependent template-id after introducing
a substitution for the scoped template-id.

llvm-svn: 105699
2010-06-09 07:26:17 +00:00
Zhongxing Xu 1225aacacf Merge StackAddrLeakChecker and ReturnStackAddressChecker.
llvm-svn: 105687
2010-06-09 06:08:24 +00:00
Zhongxing Xu 4200be5e76 Directly compare the StackFrameContext. This greatly simplifies logic and
improves generality. Thanks Ted.

llvm-svn: 105686
2010-06-09 05:50:38 +00:00
Nate Begeman 4307a25545 More accurate BuiltinsARM.def
vget_lane support

llvm-svn: 105684
2010-06-09 05:30:26 +00:00
Douglas Gregor b4e3533ce1 Fix a typo that breaks the GCC build. Turns out that Clang isn't
diagnosing this code as an error when it should, so I've filed
http://llvm.org/bugs/show_bug.cgi?id=7325. 

llvm-svn: 105683
2010-06-09 05:25:34 +00:00
Tom Care b704270779 Added FixIt support to printf format string checking.
- Refactored LengthModifier to be a class.
- Added toString methods in all member classes of FormatSpecifier.
- FixIt suggestions keep user specified flags unless incorrect.

Limitations:
- The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation.

A    test/Sema/format-strings-fixit.c
M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp
M    lib/Sema/SemaChecking.cpp

llvm-svn: 105680
2010-06-09 04:11:11 +00:00
Douglas Gregor 1fc3d66da4 Tweak our handling of the notion of a standard conversion sequence
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.

llvm-svn: 105678
2010-06-09 03:53:18 +00:00
Rafael Espindola 6bb986d530 Simplify the code a bit and avoid a gcc waring about uninitialized variables.
llvm-svn: 105676
2010-06-09 03:48:40 +00:00
Anders Carlsson 635186a8c4 Get rid of getMangledCXXCtorName and getMangledCXXDtorName.
llvm-svn: 105673
2010-06-09 02:36:32 +00:00
Anders Carlsson 09b5fe68ab More mangling cleanup.
llvm-svn: 105672
2010-06-09 02:30:12 +00:00
Anders Carlsson d4ce4e4bc0 Get rid of an unnecessary getMangledName overload.
llvm-svn: 105671
2010-06-09 02:20:01 +00:00
Rafael Espindola 9cdbd9dc08 Fix a gcc warning.
llvm-svn: 105670
2010-06-09 02:17:08 +00:00
Nate Begeman 5548309fa7 Implement transpose/zip/unzip & table lookup.
Test out some basic constant-checking.

llvm-svn: 105667
2010-06-09 01:10:23 +00:00
Ted Kremenek 076baeb03e Fix memory leak in ASTContext where ASTRecordLayout objects involving C++ structures wouldn't have
their associated memory destroyed when using a BumpPtrAllocator.  These objects internally use
a DenseMap.

llvm-svn: 105659
2010-06-08 23:00:58 +00:00
Ted Kremenek dea66e3e4c Fix memory leak in Preprocessor where MacroInfo objects in the MICache wouldn't have their
associated SmallVectors get deallocated.

llvm-svn: 105658
2010-06-08 23:00:53 +00:00
Jordy Rose 954238366b Code cleanup: remove explicit flush() in favor of using the ostream's str()
llvm-svn: 105657
2010-06-08 22:59:01 +00:00
Anders Carlsson 851318a93a On Darwin, initialization and destruction functions should go into the __StaticInit section.
llvm-svn: 105650
2010-06-08 22:47:50 +00:00
Anders Carlsson b2839e4aa1 Add a global CreateGlobalInitOrDestructFunction and use it for creating global init or destruction functions.
llvm-svn: 105649
2010-06-08 22:40:05 +00:00
Anders Carlsson 9eb101c5d3 Rename __tcf_ to __cxx_global_array_dtor. Remove the UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead.
llvm-svn: 105648
2010-06-08 22:30:17 +00:00
Anders Carlsson 282bc10eaa Move GenerateCXXAggrDestructorHelper to CGDeclCXX.cpp where it belongs.
llvm-svn: 105647
2010-06-08 22:17:27 +00:00
Anders Carlsson 165ec0a04f Simplify GenerateCXXAggrDestructorHelper.
llvm-svn: 105646
2010-06-08 22:14:59 +00:00
Douglas Gregor 6f2e095f06 When referring to a tag that was previously declared only as a friend,
build a new declaration for that tag type that will be visible for
future lookups of that tag.

llvm-svn: 105643
2010-06-08 21:27:36 +00:00
Douglas Gregor ce21919bd6 A built-in overload candidate is consider a non-template function when
determining whether one overload candidate is better than
another. Fixes PR7319.

llvm-svn: 105642
2010-06-08 21:03:17 +00:00
Fariborz Jahanian 3b83618054 Block Code Gen. API. Call destructor on descriptior
entry previously constructed via copy constructor.

llvm-svn: 105641
2010-06-08 20:57:22 +00:00
Daniel Dunbar 5d02e0bd8a Simplify libIndex Makefile, which doesn't need to worry about altivec support.
llvm-svn: 105639
2010-06-08 20:57:18 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Douglas Gregor ec170db73d Warn about comparisons between arrays and improve self-comparison
warnings, from Troy Straszheim! Fixes PR6163.

llvm-svn: 105631
2010-06-08 19:50:34 +00:00
Anders Carlsson 446872069f Correctly handle fields with virtual bases containing empty subobjects.
llvm-svn: 105628
2010-06-08 19:09:24 +00:00
Fariborz Jahanian 8e73928f52 Fixes a typo which prevented proper code gen. for
copy-in of c++ class objects into blocks.

llvm-svn: 105622
2010-06-08 17:52:11 +00:00
Douglas Gregor 4038cf4b57 Implement a warning when converting the literal 'false' to a
pointer. Original patch by Troy D. Straszheim; fixes PR7283.

llvm-svn: 105621
2010-06-08 17:35:15 +00:00
Anders Carlsson 45c1d2898e When checking whether we can place a base subobject at an offset, we don't need to go past the highest offset that's known to contain an empty base subobject.
llvm-svn: 105611
2010-06-08 16:20:35 +00:00
Anders Carlsson cc5de097a6 Minor cleanups to the empty subobject map.
llvm-svn: 105608
2010-06-08 15:56:03 +00:00
Anders Carlsson 248704c517 Correctly mangle static variables of anonymous struct/union type.
llvm-svn: 105606
2010-06-08 14:49:03 +00:00
Zhongxing Xu 87e7fc5dc2 Add a checker check if a global variable holds a local variable's address after
the function call is left where the local variable is declared.

llvm-svn: 105602
2010-06-08 10:00:00 +00:00
Nate Begeman ae6b1d8010 Fix NEON intrinsic argument passing, support vext. Most now successfully make it through codegen to the .s file
llvm-svn: 105599
2010-06-08 06:03:01 +00:00
Jeffrey Yasskin 460aa54d0a Implement -fcaret-diagnostics to undo -fno-caret-diagnostics.
llvm-svn: 105597
2010-06-08 04:56:20 +00:00
Rafael Espindola 895e51de4a Fix what looks like a merge problem that broke __clear_cache.
llvm-svn: 105595
2010-06-08 03:52:53 +00:00
Nate Begeman 4904e32d46 Since the enum values for each arch's builtins overlap, it is not appropriate to check them when compiling or other archs. Fixes a problem where compiling for NEON would use x86 sema rules.
llvm-svn: 105593
2010-06-08 02:47:44 +00:00
Rafael Espindola bbd44ef673 Fix passing and returning of objects with non trivial copy constructors on
ARM.

Fixes PR7310.

llvm-svn: 105592
2010-06-08 02:42:08 +00:00
Nate Begeman 16372afeab Implement ARM NEON up through vcvt, alphabetically.
llvm-svn: 105590
2010-06-08 00:17:19 +00:00
Nate Begeman a011002195 Extend __builtin_shufflevector to expose the full power of the llvm shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation.
llvm-svn: 105589
2010-06-08 00:16:34 +00:00
Daniel Dunbar 24e52992c0 Driver: Support invoking Clang on .ll or .bc inputs.
- We actually pretend that we have two separate types for LLVM assembly/bitcode because we need to use the standard suffixes with LTO ('clang -O4 -c t.c' should generate 't.o').

It is now possible to do something like:
  $ clang -emit-llvm -S t.c -o t.ll ... assorted other compile flags ...
  $ clang -c t.ll -o t.o ... assorted other compile flags ...
and expect that the output will be almost* identical to:
  $ clang -c t.c -o t.o ... assorted other compile flags ...
because all the target settings (default CPU, target features, etc.) will all be initialized properly by the driver/frontend.

*: This isn't perfect yet, because in practice we will end up running the optimization passes twice. It's possible to get something equivalent out with a well placed -mllvm -disable-llvm-optzns, but I'm still thinking about the cleanest way to solve this problem more generally.

llvm-svn: 105584
2010-06-07 23:28:45 +00:00
Daniel Dunbar 6f8362c6bf Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.

For example, 'llvm-as' is:
  $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
  $ clang -cc1 -emit-llvm    FOO.bc -o -
and 'opt' is, e.g.:
  $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
  $ clang -cc1 -S -o - FOO.ll

The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).

llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Daniel Dunbar 9507f9cc05 Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.

llvm-svn: 105582
2010-06-07 23:26:47 +00:00
Daniel Dunbar fcb2e6ddea FrontendAction: Track active file kind.
llvm-svn: 105581
2010-06-07 23:25:49 +00:00
Daniel Dunbar fa6214c952 Frontend: Rename hasASTSupport to hasASTFileSupport, which is more accurate.
llvm-svn: 105580
2010-06-07 23:24:43 +00:00
Daniel Dunbar aed46fcbe9 Frontend: Move some initialization from CompilerInstance to FrontendAction, to parallel what is done for AST inputs.
llvm-svn: 105579
2010-06-07 23:23:50 +00:00
Daniel Dunbar 8654638b23 Frontend: Change FrontendAction::BeginSourceFile to take the input kind instead of an IsAST bool.
llvm-svn: 105578
2010-06-07 23:23:06 +00:00
Daniel Dunbar 9b491e79fc Frontend: Lift InputKind enumeration to top level.
llvm-svn: 105577
2010-06-07 23:22:09 +00:00
Daniel Dunbar 3e11152de3 Frontend: Drop unnecessary TargetData argument to EmitBackendOutput, we always
create modules which have target data strings.

llvm-svn: 105576
2010-06-07 23:21:04 +00:00
Daniel Dunbar f976d1b205 Frontend: Factor clang::EmitBackendOutput out of CodeGenAction.
llvm-svn: 105575
2010-06-07 23:20:08 +00:00
Daniel Dunbar 6d5824f5bf Frontend: Add CodeGenOptions::SimplifyLibCalls, and eliminate LangOptions argument to BackendConsumer.
llvm-svn: 105574
2010-06-07 23:19:17 +00:00
Fariborz Jahanian be21aa34a0 When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778

llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian a2d7c34e93 Fixed a block regression caused by trying to use
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.

llvm-svn: 105549
2010-06-07 19:39:39 +00:00
Jordy Rose 3597b21f20 Catch free()s on non-regions and regions known to be not from malloc(), by checking the symbol type and memory space.
llvm-svn: 105547
2010-06-07 19:32:37 +00:00
Rafael Espindola a54062ef0c Implement __clear_cache on ARM.
llvm-svn: 105537
2010-06-07 17:26:50 +00:00
Fariborz Jahanian 28ed927ddf Use MaybeCreateCXXExprWithTemporaries for potential destruction of
created temporary. Use own initialized entity for copied in block
variables.

llvm-svn: 105533
2010-06-07 16:14:00 +00:00
Nate Begeman 5968eb270a weekend checkpoint of arm neon builtins codegen.
TODO: add remainder of builtins to CGBuiltin, add code to SemaChecking to validate constants.

llvm-svn: 105532
2010-06-07 16:01:56 +00:00
Jeffrey Yasskin caa710dfd2 PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires.

llvm-svn: 105529
2010-06-07 15:58:05 +00:00
John McCall cb0f89a434 Simplify the methods for creating a pointer, reference, member-pointer,
or block-pointer type by removing the qualifiers parameter.  Introduce a
method to perform semantic checking when adding qualifiers to a type.

llvm-svn: 105526
2010-06-05 06:41:15 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Jeffrey Yasskin 2f96e9f5c9 Add an extension to avoid an error when a global template has the same name as
a member template, and you try to call the member template with an explicit
template argument.  See PR7247 

For example, this downgrades the error to a warning in:

template<typename T> struct set{};
struct Value {
    template<typename T>
    void set(T value) {
    }
};
void foo() {
    Value v;
    v.set<double>(3.2);  // Warning here.
}

llvm-svn: 105518
2010-06-05 01:39:57 +00:00
Devang Patel 6ccba0fb6e Preserve type info for local variables in optimized builds.
llvm-gcc enabled this couple of weeks ago.

llvm-svn: 105516
2010-06-05 01:14:40 +00:00
John McCall 8cb7bdfd33 Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.
This is never null, but the associated type might be.

llvm-svn: 105503
2010-06-04 23:28:52 +00:00
Rafael Espindola e971b9a260 Correctly align large arrays in x86-64. This fixes PR5599.
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
Anders Carlsson 76f513f862 When deciding whether reinterpret_cast casts away constness we need to look at array qualifiers. Fixes rdar://problem/8018292.
llvm-svn: 105494
2010-06-04 22:47:55 +00:00
Nate Begeman 6736cc89d0 Initial support for ARM NEON builtins, codegen up next
llvm-svn: 105489
2010-06-04 21:36:27 +00:00
Fariborz Jahanian ea882cd92e Build AST for copy-construction of copied-in
class object in blocks and carry it to IRGen.

llvm-svn: 105487
2010-06-04 21:35:44 +00:00
John McCall 339bb66246 Remember type source information for Objective C property declarations.
llvm-svn: 105484
2010-06-04 20:50:08 +00:00
Fariborz Jahanian 9643399ef0 Added a field to BlockDeclRefExpr for future use.
No functionality change yet.

llvm-svn: 105479
2010-06-04 19:06:53 +00:00
John McCall 8e346702b6 Preserve more information from a block's original function declarator, if one
was given.  Remove some unnecessary accounting from BlockScopeInfo.  Handle
typedef'ed function types until such time as we decide not.

llvm-svn: 105478
2010-06-04 19:02:56 +00:00
Daniel Dunbar 7f3d95054b Driver: Change -dwarf-debug-flags option to pass the original command line
arguments after translation, instead of the -cc1 level arguments.

llvm-svn: 105476
2010-06-04 18:47:06 +00:00
Daniel Dunbar 6beaf5110f Driver/Darwin: Model dsymutil properly, as a separate action/tool kind which is
added as the last output step, instead of just hacking it into the link step.
 - Among other things, this fixes dSYM generation when using multiple -arch options.

llvm-svn: 105475
2010-06-04 18:28:41 +00:00
Daniel Dunbar 8829962030 Driver: Add an explicit dsymutil action.
llvm-svn: 105474
2010-06-04 18:28:36 +00:00
Fariborz Jahanian 64176c2c97 For C++ copied in objects, use copy constructors in
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.

llvm-svn: 105469
2010-06-04 16:10:00 +00:00
Rafael Espindola 92eb2cbbef Add ARM paths for debian. Not enough to bootstrap on a beagle board, but
moves us further.

llvm-svn: 105468
2010-06-04 14:28:10 +00:00
John McCall a3ccba0417 Restructure how we interpret block-literal declarators. Correctly handle
the case where we pick up block arguments from a typedef.  Save the block
signature as it was written, and preserve same through PCH.

llvm-svn: 105466
2010-06-04 11:21:44 +00:00
Abramo Bagnara 52d6350dd2 Don't insert in lexical context implicit definitions of static member instances.
llvm-svn: 105465
2010-06-04 09:35:39 +00:00
Douglas Gregor 2e87ca218f When checking for equality of template parameter lists, a template
type parameter pack is distinct from a template type parameter.

llvm-svn: 105464
2010-06-04 08:34:32 +00:00
John McCall b1cd7dac3d Delay checking for mutable const fields until we're checking the field.
Allows this check to work properly for instantiated fields and removes
an unnecessary GetTypeForDeclarator call.

llvm-svn: 105463
2010-06-04 08:34:12 +00:00
Douglas Gregor 71b209dea6 Properly disambiguate between an elaborated-type-specifier and a
type-parameter within a template parameter list. Found by inspection. 

llvm-svn: 105462
2010-06-04 07:30:15 +00:00
John McCall ec6f4e9017 More refactoring.
llvm-svn: 105458
2010-06-04 02:29:22 +00:00
Anders Carlsson 15722da2dc Add a short circuit in isVirtuallyDerivedFrom.
llvm-svn: 105457
2010-06-04 01:40:08 +00:00
Jordy Rose 2e22268904 Assignments to reference variables shouldn't kill the variable.
llvm-svn: 105452
2010-06-04 01:14:56 +00:00
David Chisnall b190a2c74a Fixed Objective-C type encoding for bitfields for the GNU runtime to match the encoding used by GCC.
llvm-svn: 105451
2010-06-04 01:10:52 +00:00
Anders Carlsson fd788405ac Remove now unused code.
llvm-svn: 105448
2010-06-04 00:59:37 +00:00
Anders Carlsson 27860db29e Use CXXRecordDecl::getFinalOverriders to get final overriders. This speeds up vtable layout by moving away from the old final overrider computation code that had O(N^2) complexity in some cases.
llvm-svn: 105447
2010-06-04 00:54:04 +00:00
John McCall 4a2429aa5a Remove a couple of unnecessary uses of IsStandardConversion.
llvm-svn: 105445
2010-06-04 00:29:51 +00:00
Nate Begeman 821079d42d Classify NEON intrinsics by overloading-type for codegen
Add a few missing instructions

llvm-svn: 105417
2010-06-03 21:36:23 +00:00
Eli Friedman 91a3d27ec0 Make sure to check the accessibility of and mark the destructor for the
operand of a throw expression.  Fixes PR7281.

llvm-svn: 105408
2010-06-03 20:39:03 +00:00
Eli Friedman cce5b81ce1 Don't intentionally try to ignore the value of a scalar expression when we
actually care about it. Fixes PR7291.

llvm-svn: 105404
2010-06-03 19:58:07 +00:00
John McCall 1c70e99a2c Hack in some really terrible C++ record PCH support that I need right now.
This is required in order to test:

The ASTImporter should set base classes after formally entering the definition.

llvm-svn: 105401
2010-06-03 19:28:45 +00:00