diff options
author | dim <dim@FreeBSD.org> | 2014-03-21 17:53:59 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-03-21 17:53:59 +0000 |
commit | 9cedb8bb69b89b0f0c529937247a6a80cabdbaec (patch) | |
tree | c978f0e9ec1ab92dc8123783f30b08a7fd1e2a39 /contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp | |
parent | 03fdc2934eb61c44c049a02b02aa974cfdd8a0eb (diff) | |
download | FreeBSD-src-9cedb8bb69b89b0f0c529937247a6a80cabdbaec.zip FreeBSD-src-9cedb8bb69b89b0f0c529937247a6a80cabdbaec.tar.gz |
MFC 261991:
Upgrade our copy of llvm/clang to 3.4 release. This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.
The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3. The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.
Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>
MFC 262121 (by emaste):
Update lldb for clang/llvm 3.4 import
This commit largely restores the lldb source to the upstream r196259
snapshot with the addition of threaded inferior support and a few bug
fixes.
Specific upstream lldb revisions restored include:
SVN git
181387 779e6ac
181703 7bef4e2
182099 b31044e
182650 f2dcf35
182683 0d91b80
183862 15c1774
183929 99447a6
184177 0b2934b
184948 4dc3761
184954 007e7bc
186990 eebd175
Sponsored by: DARPA, AFRL
MFC 262186 (by emaste):
Fix mismerge in r262121
A break statement was lost in the merge. The error had no functional
impact, but restore it to reduce the diff against upstream.
MFC 262303:
Pull in r197521 from upstream clang trunk (by rdivacky):
Use the integrated assembler by default on FreeBSD/ppc and ppc64.
Requested by: jhibbits
MFC 262611:
Pull in r196874 from upstream llvm trunk:
Fix a crash that occurs when PWD is invalid.
MCJIT needs to be able to run in hostile environments, even when PWD
is invalid. There's no need to crash MCJIT in this case.
The obvious fix is to simply leave MCContext's CompilationDir empty
when PWD can't be determined. This way, MCJIT clients,
and other clients that link with LLVM don't need a valid working directory.
If we do want to guarantee valid CompilationDir, that should be done
only for clients of getCompilationDir(). This is as simple as checking
for an empty string.
The only current use of getCompilationDir is EmitGenDwarfInfo, which
won't conceivably run with an invalid working dir. However, in the
purely hypothetically and untestable case that this happens, the
AT_comp_dir will be omitted from the compilation_unit DIE.
This should help fix assertions occurring with ports-mgmt/tinderbox,
when it is using jails, and sometimes invalidates clang's current
working directory.
Reported by: decke
MFC 262809:
Pull in r203007 from upstream clang trunk:
Don't produce an alias between destructors with different calling conventions.
Fixes pr19007.
(Please note that is an LLVM PR identifier, not a FreeBSD one.)
This should fix Firefox and/or libxul crashes (due to problems with
regparm/stdcall calling conventions) on i386.
Reported by: multiple users on freebsd-current
PR: bin/187103
MFC 263048:
Repair recognition of "CC" as an alias for the C++ compiler, since it
was silently broken by upstream for a Windows-specific use-case.
Apparently some versions of CMake still rely on this archaic feature...
Reported by: rakuco
MFC 263049:
Garbage collect the old way of adding the libstdc++ include directories
in clang's InitHeaderSearch.cpp. This has been superseded by David
Chisnall's commit in r255321.
Moreover, if libc++ is used, the libstdc++ include directories should
not be in the search path at all. These directories are now only used
if you pass -stdlib=libstdc++.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp | 104 |
1 files changed, 41 insertions, 63 deletions
diff --git a/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp b/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp index 353af4b..9d99fbe 100644 --- a/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp +++ b/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp @@ -16,6 +16,7 @@ #include "clang/Basic/DiagnosticCategories.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/ErrorHandling.h" #include <map> using namespace clang; @@ -35,11 +36,10 @@ enum { }; struct StaticDiagInfoRec { - unsigned short DiagID; + uint16_t DiagID; unsigned Mapping : 3; unsigned Class : 3; - unsigned SFINAE : 1; - unsigned AccessControl : 1; + unsigned SFINAE : 2; unsigned WarnNoWerror : 1; unsigned WarnShowInSystemHeader : 1; unsigned Category : 5; @@ -66,9 +66,9 @@ struct StaticDiagInfoRec { static const StaticDiagInfoRec StaticDiagInfo[] = { #define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP, \ - SFINAE,ACCESS,NOWERROR,SHOWINSYSHEADER, \ - CATEGORY) \ - { diag::ENUM, DEFAULT_MAPPING, CLASS, SFINAE, ACCESS, \ + SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) \ + { diag::ENUM, DEFAULT_MAPPING, CLASS, \ + DiagnosticIDs::SFINAE, \ NOWERROR, SHOWINSYSHEADER, CATEGORY, GROUP, \ STR_SIZE(DESC, uint16_t), DESC }, #include "clang/Basic/DiagnosticCommonKinds.inc" @@ -82,18 +82,16 @@ static const StaticDiagInfoRec StaticDiagInfo[] = { #include "clang/Basic/DiagnosticSemaKinds.inc" #include "clang/Basic/DiagnosticAnalysisKinds.inc" #undef DIAG - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; -static const unsigned StaticDiagInfoSize = - sizeof(StaticDiagInfo)/sizeof(StaticDiagInfo[0])-1; +static const unsigned StaticDiagInfoSize = llvm::array_lengthof(StaticDiagInfo); /// GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID, /// or null if the ID is invalid. static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { // If assertions are enabled, verify that the StaticDiagInfo array is sorted. #ifndef NDEBUG - static bool IsFirst = true; + static bool IsFirst = true; // So the check is only performed on first call. if (IsFirst) { for (unsigned i = 1; i != StaticDiagInfoSize; ++i) { assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID && @@ -109,7 +107,7 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { // Out of bounds diag. Can't be in the table. using namespace diag; - if (DiagID >= DIAG_UPPER_LIMIT) + if (DiagID >= DIAG_UPPER_LIMIT || DiagID <= DIAG_START_COMMON) return 0; // Compute the index of the requested diagnostic in the static table. @@ -121,8 +119,7 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { // This is cheaper than a binary search on the table as it doesn't touch // memory at all. unsigned Offset = 0; - unsigned ID = DiagID; -#define DIAG_START_COMMON 0 // Sentinel value. + unsigned ID = DiagID - DIAG_START_COMMON - 1; #define CATEGORY(NAME, PREV) \ if (DiagID > DIAG_START_##NAME) { \ Offset += NUM_BUILTIN_##PREV##_DIAGNOSTICS - DIAG_START_##PREV - 1; \ @@ -138,7 +135,6 @@ CATEGORY(COMMENT, AST) CATEGORY(SEMA, COMMENT) CATEGORY(ANALYSIS, SEMA) #undef CATEGORY -#undef DIAG_START_COMMON // Avoid out of bounds reads. if (ID + Offset >= StaticDiagInfoSize) @@ -224,7 +220,7 @@ static const StaticDiagCategoryRec CategoryNameTable[] = { /// getNumberOfCategories - Return the number of categories unsigned DiagnosticIDs::getNumberOfCategories() { - return sizeof(CategoryNameTable) / sizeof(CategoryNameTable[0])-1; + return llvm::array_lengthof(CategoryNameTable) - 1; } /// getCategoryNameFromID - Given a category ID, return the name of the @@ -238,22 +234,10 @@ StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) { -DiagnosticIDs::SFINAEResponse +DiagnosticIDs::SFINAEResponse DiagnosticIDs::getDiagnosticSFINAEResponse(unsigned DiagID) { - if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) { - if (Info->AccessControl) - return SFINAE_AccessControl; - - if (!Info->SFINAE) - return SFINAE_Report; - - if (Info->Class == CLASS_ERROR) - return SFINAE_SubstitutionFailure; - - // Suppress notes, warnings, and extensions; - return SFINAE_Suppress; - } - + if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) + return static_cast<DiagnosticIDs::SFINAEResponse>(Info->SFINAE); return SFINAE_Report; } @@ -504,36 +488,34 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, return Result; } -struct clang::WarningOption { - // Be safe with the size of 'NameLen' because we don't statically check if - // the size will fit in the field; the struct size won't decrease with a - // shorter type anyway. - size_t NameLen; - const char *NameStr; - const short *Members; - const short *SubGroups; - - StringRef getName() const { - return StringRef(NameStr, NameLen); - } -}; - #define GET_DIAG_ARRAYS #include "clang/Basic/DiagnosticGroups.inc" #undef GET_DIAG_ARRAYS +namespace { + struct WarningOption { + uint16_t NameOffset; + uint16_t Members; + uint16_t SubGroups; + + // String is stored with a pascal-style length byte. + StringRef getName() const { + return StringRef(DiagGroupNames + NameOffset + 1, + DiagGroupNames[NameOffset]); + } + }; +} + // Second the table of options, sorted by name for fast binary lookup. static const WarningOption OptionTable[] = { #define GET_DIAG_TABLE #include "clang/Basic/DiagnosticGroups.inc" #undef GET_DIAG_TABLE }; -static const size_t OptionTableSize = -sizeof(OptionTable) / sizeof(OptionTable[0]); +static const size_t OptionTableSize = llvm::array_lengthof(OptionTable); -static bool WarningOptionCompare(const WarningOption &LHS, - const WarningOption &RHS) { - return LHS.getName() < RHS.getName(); +static bool WarningOptionCompare(const WarningOption &LHS, StringRef RHS) { + return LHS.getName() < RHS; } /// getWarningOptionForDiag - Return the lowest-level warning option that @@ -545,34 +527,30 @@ StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) { return StringRef(); } -void DiagnosticIDs::getDiagnosticsInGroup( - const WarningOption *Group, - SmallVectorImpl<diag::kind> &Diags) const { +static void getDiagnosticsInGroup(const WarningOption *Group, + SmallVectorImpl<diag::kind> &Diags) { // Add the members of the option diagnostic set. - if (const short *Member = Group->Members) { - for (; *Member != -1; ++Member) - Diags.push_back(*Member); - } + const int16_t *Member = DiagArrays + Group->Members; + for (; *Member != -1; ++Member) + Diags.push_back(*Member); // Add the members of the subgroups. - if (const short *SubGroups = Group->SubGroups) { - for (; *SubGroups != (short)-1; ++SubGroups) - getDiagnosticsInGroup(&OptionTable[(short)*SubGroups], Diags); - } + const int16_t *SubGroups = DiagSubGroups + Group->SubGroups; + for (; *SubGroups != (int16_t)-1; ++SubGroups) + getDiagnosticsInGroup(&OptionTable[(short)*SubGroups], Diags); } bool DiagnosticIDs::getDiagnosticsInGroup( StringRef Group, SmallVectorImpl<diag::kind> &Diags) const { - WarningOption Key = { Group.size(), Group.data(), 0, 0 }; const WarningOption *Found = - std::lower_bound(OptionTable, OptionTable + OptionTableSize, Key, + std::lower_bound(OptionTable, OptionTable + OptionTableSize, Group, WarningOptionCompare); if (Found == OptionTable + OptionTableSize || Found->getName() != Group) return true; // Option not found. - getDiagnosticsInGroup(Found, Diags); + ::getDiagnosticsInGroup(Found, Diags); return false; } |