diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-03-21 21:29:27 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-03-21 21:29:27 +0000 |
commit | a458b52fcb59a9aa44eef20325adb066ccfd8e99 (patch) | |
tree | 70c2366467be5cdb56a6dd07d2d0e85ad4aab040 | |
parent | 24ed835446f5f31464e489c177ff1996fb01842a (diff) | |
download | llvm-a458b52fcb59a9aa44eef20325adb066ccfd8e99.zip llvm-a458b52fcb59a9aa44eef20325adb066ccfd8e99.tar.gz llvm-a458b52fcb59a9aa44eef20325adb066ccfd8e99.tar.bz2 |
--- Merging r127405 into '.':
U lib/CodeGen/CGCall.cpp
--- Merging r127507 into '.':
A test/SemaCXX/cxx0x-return-init-list.cpp
U include/clang/Basic/DiagnosticParseKinds.td
U lib/Parse/ParseStmt.cpp
--- Merging r127583 into '.':
U lib/Driver/ToolChains.cpp
--- Merging r127582 into '.':
U lib/Frontend/InitHeaderSearch.cpp
llvm-svn: 128024
-rw-r--r-- | clang/include/clang/Basic/DiagnosticParseKinds.td | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 12 | ||||
-rw-r--r-- | clang/lib/Frontend/InitHeaderSearch.cpp | 24 | ||||
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 11 | ||||
-rw-r--r-- | clang/test/SemaCXX/cxx0x-return-init-list.cpp | 18 |
6 files changed, 67 insertions, 7 deletions
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 20b6419..4b3a0e3 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -178,6 +178,9 @@ def ext_ref_qualifier : ExtWarn< "reference qualifiers on functions are a C++0x extension">, InGroup<CXX0x>; def ext_inline_namespace : ExtWarn< "inline namespaces are a C++0x feature">, InGroup<CXX0x>; +def ext_generalized_initializer_lists : ExtWarn< + "generalized initializer lists are a C++0x extension unsupported in Clang">, + InGroup<CXX0x>; def err_argument_required_after_attribute : Error< "argument required after attribute">; def err_missing_param : Error<"expected parameter declarator">; diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index bd14d1b..56815dc9 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -881,8 +881,10 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, // copy. const llvm::Type *I8PtrTy = Builder.getInt8PtrTy(); CharUnits Size = getContext().getTypeSizeInChars(Ty); - Builder.CreateMemCpy(Builder.CreateBitCast(AlignedTemp, I8PtrTy), - Builder.CreateBitCast(V, I8PtrTy), + llvm::Value *Dst = Builder.CreateBitCast(AlignedTemp, I8PtrTy); + llvm::Value *Src = Builder.CreateBitCast(V, I8PtrTy); + Builder.CreateMemCpy(Dst, + Src, llvm::ConstantInt::get(IntPtrTy, Size.getQuantity()), ArgI.getIndirectAlign(), diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 7cae9ba..dc35a33 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -1280,6 +1280,8 @@ enum LinuxDistro { Fedora13, Fedora14, OpenSuse11_3, + UbuntuHardy, + UbuntuIntrepid, UbuntuJaunty, UbuntuKarmic, UbuntuLucid, @@ -1300,7 +1302,8 @@ static bool IsDebian(enum LinuxDistro Distro) { } static bool IsUbuntu(enum LinuxDistro Distro) { - return Distro == UbuntuLucid || Distro == UbuntuMaverick || + return Distro == UbuntuHardy || Distro == UbuntuIntrepid || + Distro == UbuntuLucid || Distro == UbuntuMaverick || Distro == UbuntuJaunty || Distro == UbuntuKarmic; } @@ -1329,6 +1332,10 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { llvm::SmallVector<llvm::StringRef, 8> Lines; Data.split(Lines, "\n"); for (unsigned int i = 0, s = Lines.size(); i < s; ++ i) { + if (Lines[i] == "DISTRIB_CODENAME=hardy") + return UbuntuHardy; + if (Lines[i] == "DISTRIB_CODENAME=intrepid") + return UbuntuIntrepid; if (Lines[i] == "DISTRIB_CODENAME=maverick") return UbuntuMaverick; else if (Lines[i] == "DISTRIB_CODENAME=lucid") @@ -1444,7 +1451,8 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4", "4.4.3", "4.4", "4.3.4", "4.3.3", "4.3.2", - "4.3"}; + "4.3", "4.2.4", "4.2.3", "4.2.2", "4.2.1", + "4.2"}; std::string Base = ""; for (unsigned i = 0; i < sizeof(GccVersions)/sizeof(char*); ++i) { std::string Suffix = GccTriple + "/" + GccVersions[i]; diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index 4b1f782..60c3e9c 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -741,7 +741,19 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { "i686-pc-linux-gnu", "", "", triple); AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", "x86_64-unknown-linux-gnu", "", "", triple); - // Gentoo x86 2010.0 stable + // Gentoo x86 gcc 4.5.2 + AddGnuCPlusPlusIncludePaths( + "/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/g++-v4", + "i686-pc-linux-gnu", "", "", triple); + // Gentoo x86 gcc 4.4.5 + AddGnuCPlusPlusIncludePaths( + "/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/include/g++-v4", + "i686-pc-linux-gnu", "", "", triple); + // Gentoo x86 gcc 4.4.4 + AddGnuCPlusPlusIncludePaths( + "/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4", + "i686-pc-linux-gnu", "", "", triple); + // Gentoo x86 2010.0 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); @@ -757,7 +769,15 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); + // Gentoo x86 llvm-gcc trunk + AddGnuCPlusPlusIncludePaths( + "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1", + "i686-pc-linux-gnu", "", "", triple); + // Gentoo amd64 gcc 4.5.2 + AddGnuCPlusPlusIncludePaths( + "/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4", + "x86_64-pc-linux-gnu", "32", "", triple); // Gentoo amd64 gcc 4.4.5 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4", @@ -777,7 +797,7 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { // Gentoo amd64 stable AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4", - "i686-pc-linux-gnu", "", "", triple); + "x86_64-pc-linux-gnu", "", "", triple); // Gentoo amd64 llvm-gcc trunk AddGnuCPlusPlusIncludePaths( diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index e3e8dc5..cd970ca 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -1267,7 +1267,16 @@ StmtResult Parser::ParseReturnStatement(ParsedAttributes &attrs) { return StmtError(); } - R = ParseExpression(); + // FIXME: This is a hack to allow something like C++0x's generalized + // initializer lists, but only enough of this feature to allow Clang to + // parse libstdc++ 4.5's headers. + if (Tok.is(tok::l_brace) && getLang().CPlusPlus) { + R = ParseInitializer(); + if (R.isUsable() && !getLang().CPlusPlus0x) + Diag(R.get()->getLocStart(), diag::ext_generalized_initializer_lists) + << R.get()->getSourceRange(); + } else + R = ParseExpression(); if (R.isInvalid()) { // Skip to the semicolon, but don't consume it. SkipUntil(tok::semi, false, true); return StmtError(); diff --git a/clang/test/SemaCXX/cxx0x-return-init-list.cpp b/clang/test/SemaCXX/cxx0x-return-init-list.cpp new file mode 100644 index 0000000..2005a7f --- /dev/null +++ b/clang/test/SemaCXX/cxx0x-return-init-list.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// This test checks for a teeny tiny subset of the functionality in +// the C++0x generalized initializer lists feature, which happens to +// be used in libstdc++ 4.5. We accept only this syntax so that Clang +// can handle the libstdc++ 4.5 headers. + +int test0(int i) { + return { i }; // expected-warning{{generalized initializer lists are a C++0x extension unsupported in Clang}} +} + +template<typename T, typename U> +T test1(U u) { + return { u }; // expected-warning{{generalized initializer lists are a C++0x extension unsupported in Clang}} +} + +template int test1(char); +template long test1(int); |