diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-03-16 16:52:15 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-03-16 16:52:15 +0000 |
commit | 1033b7c1e32962948b01a25145829f17bc70a8de (patch) | |
tree | 52aebaff3a47b97dbac434530524c30967468412 /include/clang/Basic | |
parent | 27c39af73c0d7d0b97e57b3a905040d4cefc9708 (diff) | |
download | FreeBSD-src-1033b7c1e32962948b01a25145829f17bc70a8de.zip FreeBSD-src-1033b7c1e32962948b01a25145829f17bc70a8de.tar.gz |
Update clang to r98631.
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/Builtins.def | 4 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsX86.def | 6 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticCommonKinds.td | 8 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 3 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 1 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 49 | ||||
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 29 | ||||
-rw-r--r-- | include/clang/Basic/LangOptions.h | 3 | ||||
-rw-r--r-- | include/clang/Basic/PartialDiagnostic.h | 4 | ||||
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 7 | ||||
-rw-r--r-- | include/clang/Basic/SourceManager.h | 73 |
11 files changed, 134 insertions, 53 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index af233b8..3afdaf5 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -46,8 +46,8 @@ // U -> unsigned // // Types may be postfixed with the following modifiers: -// * -> pointer -// & -> reference +// * -> pointer (optionally followed by an address space number) +// & -> reference (optionally followed by an address space number) // C -> const // D -> volatile diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 880b4ba..9a79f90 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -287,6 +287,10 @@ BUILTIN(__builtin_ia32_roundpd, "V2dV2di", "") BUILTIN(__builtin_ia32_dpps, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_dppd, "V2dV2dV2di", "") BUILTIN(__builtin_ia32_movntdqa, "V2LLiV2LLi*", "") - +BUILTIN(__builtin_ia32_ptestz128, "iV2LLiV2LLi", "") +BUILTIN(__builtin_ia32_ptestc128, "iV2LLiV2LLi", "") +BUILTIN(__builtin_ia32_ptestnzc128, "iV2LLiV2LLi", "") +BUILTIN(__builtin_ia32_pcmpeqq, "V2LLiV2LLiV2LLi", "") +BUILTIN(__builtin_ia32_mpsadbw128, "V16cV16cV16ci", "") #undef BUILTIN diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 66f84db..849e643 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -63,4 +63,12 @@ def err_target_unknown_cpu : Error<"unknown target CPU '%0'">; def err_target_unknown_abi : Error<"unknown target ABI '%0'">; def err_target_invalid_feature : Error<"invalid target feature '%0'">; +// Source manager +def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal; +def err_file_size_changed : Error< + "size of file '%0' changed since it was first processed (from %1 to %2)">, + DefaultFatal; +def err_file_modified : Error< + "file '%0' modified since it was first processed">, DefaultFatal; + } diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 17bad64..e5793fa 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -59,7 +59,7 @@ def : DiagGroup<"nested-externs">; def : DiagGroup<"newline-eof">; def LongLong : DiagGroup<"long-long">; def MismatchedTags : DiagGroup<"mismatched-tags">; -def : DiagGroup<"missing-field-initializers">; +def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; def NonNull : DiagGroup<"nonnull">; def : DiagGroup<"nonportable-cfstrings">; def : DiagGroup<"non-virtual-dtor">; @@ -147,6 +147,7 @@ def Format2 : DiagGroup<"format=2", [FormatNonLiteral, FormatSecurity, FormatY2K]>; def Extra : DiagGroup<"extra", [ + MissingFieldInitializers, SemiBeforeMethodBody, SignCompare, UnusedParameter diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 80a4eae..9d001d4 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -183,6 +183,7 @@ def err_objc_no_attributes_on_category : Error< def err_objc_missing_end : Error<"missing @end">; def warn_objc_protocol_qualifier_missing_id : Warning< "protocol qualifiers without 'id' is archaic">; +def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">; def err_objc_illegal_visibility_spec : Error< "illegal visibility specification">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 13ac9ec..9a9b7cc 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -428,11 +428,39 @@ def err_deep_exception_specs_differ : Error< // C++ access checking def err_class_redeclared_with_different_access : Error< "%0 redeclared with '%1' access">; -def err_access_private : Error<"%0 is a private member of %1">; -def err_access_ctor_private : Error<"calling a private constructor of %0">; -// Say something about the context for these? -def err_access_protected : Error<"%0 is a protected member of %1">; -def err_access_ctor_protected : Error<"calling a protected constructor of %0">; +def err_access : + Error<"%1 is a %select{private|protected}0 member of %3">, + NoSFINAE; +def err_access_ctor : + Error<"calling a %select{private|protected}0 constructor of class %2">, + NoSFINAE; +def err_access_dtor_base : + Error<"base class %0 has %select{private|protected}1 destructor">, + NoSFINAE; +def err_access_dtor_vbase : + Error<"inherited virtual base class %0 has " + "%select{private|protected}1 destructor">, + NoSFINAE; +def err_access_dtor_field : + Error<"field of type %1 has %select{private|protected}2 destructor">, + NoSFINAE; +def err_access_dtor_var : + Error<"variable of type %1 has %select{private|protected}2 destructor">, + NoSFINAE; +def err_access_assign_field : + Error<"field of type %1 has %select{private|protected}2 copy assignment" + " operator">, + NoSFINAE; +def err_access_assign_base : + Error<"base class %0 has %select{private|protected}1 copy assignment" + " operator">, + NoSFINAE; +def err_access_copy_field : + Error<"field of type %1 has %select{private|protected}2 copy constructor">, + NoSFINAE; +def err_access_copy_base : + Error<"base class %0 has %select{private|protected}1 copy constructor">, + NoSFINAE; def note_previous_access_declaration : Note< "previously declared '%1' here">; def err_access_outside_class : Error< @@ -1251,7 +1279,7 @@ def err_not_class_template_specialization : Error< def err_template_spec_needs_header : Error< "template specialization requires 'template<>'">; def err_template_spec_needs_template_parameters : Error< - "template specialization or definition requires a template parameter list" + "template specialization or definition requires a template parameter list " "corresponding to the nested type %0">; def err_template_param_list_matches_nontemplate : Error< "template parameter list matching the non-templated nested type %0 should " @@ -1562,6 +1590,9 @@ def warn_excess_initializers_in_char_array_initializer : ExtWarn< "excess elements in char array initializer">; def warn_initializer_string_for_char_array_too_long : ExtWarn< "initializer-string for char array is too long">; +def warn_missing_field_initializers : Warning< + "missing field '%0' initializer">, + InGroup<MissingFieldInitializers>, DefaultIgnore; def warn_braces_around_scalar_init : Warning< "braces around scalar initializer">; def err_many_braces_around_scalar_init : Error< @@ -1854,6 +1885,12 @@ def warn_mixed_sign_comparison : Warning< def warn_mixed_sign_conditional : Warning< "operands of ? are integers of different signs: %0 and %1">, InGroup<DiagGroup<"sign-compare">>, DefaultIgnore; +def warn_lunsigned_always_true_comparison : Warning< + "comparison of unsigned expression %0 is always %1">, + InGroup<DiagGroup<"sign-compare">>, DefaultIgnore; +def warn_runsigned_always_true_comparison : Warning< + "comparison of %0 unsigned expression is always %1">, + InGroup<DiagGroup<"sign-compare">>, DefaultIgnore; def err_invalid_this_use : Error< "invalid use of 'this' outside of a nonstatic member function">; diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 75a7b81..582d59c 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -18,6 +18,7 @@ #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/TokenKinds.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Support/PointerLikeTypeTraits.h" @@ -236,9 +237,7 @@ public: /// Unlike the version in IdentifierTable, this returns a pointer instead /// of a reference. If the pointer is NULL then the IdentifierInfo cannot /// be found. - // - // FIXME: Move to StringRef API. - virtual IdentifierInfo* get(const char *NameStart, const char *NameEnd) = 0; + virtual IdentifierInfo* get(llvm::StringRef Name) = 0; }; /// \brief An abstract class used to resolve numerical identifier @@ -283,16 +282,16 @@ public: /// get - Return the identifier token info for the specified named identifier. /// - IdentifierInfo &get(const char *NameStart, const char *NameEnd) { + IdentifierInfo &get(llvm::StringRef Name) { llvm::StringMapEntry<IdentifierInfo*> &Entry = - HashTable.GetOrCreateValue(NameStart, NameEnd); + HashTable.GetOrCreateValue(Name); IdentifierInfo *II = Entry.getValue(); if (II) return *II; // No entry; if we have an external lookup, look there first. if (ExternalLookup) { - II = ExternalLookup->get(NameStart, NameEnd); + II = ExternalLookup->get(Name); if (II) { // Cache in the StringMap for subsequent lookups. Entry.setValue(II); @@ -312,6 +311,14 @@ public: return *II; } + IdentifierInfo &get(const char *NameStart, const char *NameEnd) { + return get(llvm::StringRef(NameStart, NameEnd-NameStart)); + } + + IdentifierInfo &get(const char *Name, size_t NameLen) { + return get(llvm::StringRef(Name, NameLen)); + } + /// \brief Creates a new IdentifierInfo from the given string. /// /// This is a lower-level version of get() that requires that this @@ -343,10 +350,6 @@ public: return CreateIdentifierInfo(Name.begin(), Name.end()); } - IdentifierInfo &get(llvm::StringRef Name) { - return get(Name.begin(), Name.end()); - } - typedef HashTableTy::const_iterator iterator; typedef HashTableTy::const_iterator const_iterator; @@ -474,9 +477,7 @@ public: SelectorName = "set"; SelectorName += Name->getName(); SelectorName[3] = toupper(SelectorName[3]); - IdentifierInfo *SetterName = - &Idents.get(SelectorName.data(), - SelectorName.data() + SelectorName.size()); + IdentifierInfo *SetterName = &Idents.get(SelectorName); return SelTable.getUnarySelector(SetterName); } }; @@ -533,7 +534,7 @@ struct DenseMapInfo<clang::Selector> { return LHS == RHS; } }; - + template <> struct isPodLike<clang::Selector> { static const bool value = true; }; diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 23e6efe..fdf69d0 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -44,6 +44,7 @@ public: unsigned PascalStrings : 1; // Allow Pascal strings unsigned WritableStrings : 1; // Allow writable strings + unsigned ConstStrings : 1; // Add const qualifier to strings (-Wwrite-strings) unsigned LaxVectorConversions : 1; unsigned AltiVec : 1; // Support AltiVec-style vector initializers. unsigned Exceptions : 1; // Support exception handling. @@ -129,7 +130,7 @@ public: HexFloats = 0; GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0; C99 = Microsoft = CPlusPlus = CPlusPlus0x = 0; - CXXOperatorNames = PascalStrings = WritableStrings = 0; + CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0; NeXTRuntime = 1; RTTI = 1; diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 873aaee..fb861dc 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -69,6 +69,10 @@ class PartialDiagnostic { CodeModificationHint CodeModificationHints[MaxCodeModificationHints]; }; + // NOTE: Sema assumes that PartialDiagnostic is location-invariant + // in the sense that its bits can be safely memcpy'ed and destructed + // in the new location. + /// DiagID - The diagnostic ID. mutable unsigned DiagID; diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index d4f557b..34dfecd 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -20,6 +20,7 @@ namespace llvm { class MemoryBuffer; class raw_ostream; + class StringRef; template <typename T> struct DenseMapInfo; template <typename T> struct isPodLike; } @@ -209,9 +210,9 @@ public: const llvm::MemoryBuffer* getBuffer() const; - /// getBufferData - Return a pointer to the start and end of the source buffer - /// data for the specified FileID. - std::pair<const char*, const char*> getBufferData() const; + /// getBufferData - Return a StringRef to the source buffer data for the + /// specified FileID. + llvm::StringRef getBufferData() const; /// getDecomposedLoc - Decompose the specified location into a raw FileID + /// Offset pair. The first element is the FileID, the second is the diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 15ece68..ef51a58 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -17,22 +17,24 @@ #include "clang/Basic/SourceLocation.h" #include "llvm/Support/Allocator.h" #include "llvm/System/DataTypes.h" +#include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/DenseMap.h" #include <vector> #include <cassert> namespace llvm { class MemoryBuffer; +class StringRef; } namespace clang { +class Diagnostic; class SourceManager; class FileManager; class FileEntry; -class IdentifierTokenInfo; class LineTableInfo; - + /// SrcMgr - Public enums and private classes that are part of the /// SourceManager implementation. /// @@ -69,10 +71,14 @@ namespace SrcMgr { /// if SourceLineCache is non-null. unsigned NumLines; - /// getBuffer - Returns the memory buffer for the associated content. If - /// there is an error opening this buffer the first time, this manufactures - /// a temporary buffer and returns a non-empty error string. - const llvm::MemoryBuffer *getBuffer(std::string *ErrorStr = 0) const; + /// getBuffer - Returns the memory buffer for the associated content. + /// + /// \param Diag Object through which diagnostics will be emitted it the + /// buffer cannot be retrieved. + /// + /// \param Invalid If non-NULL, will be set \c true if an error occurred. + const llvm::MemoryBuffer *getBuffer(Diagnostic &Diag, + bool *Invalid = 0) const; /// getSize - Returns the size of the content encapsulated by this /// ContentCache. This can be the size of the source file or the size of an @@ -277,6 +283,9 @@ public: /// location indicates where the expanded token came from and the instantiation /// location specifies where it was expanded. class SourceManager { + /// \brief Diagnostic object. + Diagnostic &Diag; + mutable llvm::BumpPtrAllocator ContentCacheAlloc; /// FileInfos - Memoized information about all of the files tracked by this @@ -336,8 +345,8 @@ class SourceManager { explicit SourceManager(const SourceManager&); void operator=(const SourceManager&); public: - SourceManager() - : ExternalSLocEntries(0), LineTable(0), NumLinearScans(0), + SourceManager(Diagnostic &Diag) + : Diag(Diag), ExternalSLocEntries(0), LineTable(0), NumLinearScans(0), NumBinaryProbes(0) { clearIDTables(); } @@ -408,7 +417,11 @@ public: unsigned Offset = 0); /// \brief Retrieve the memory buffer associated with the given file. - const llvm::MemoryBuffer *getMemoryBufferForFile(const FileEntry *File); + /// + /// \param Invalid If non-NULL, will be set \c true if an error + /// occurs while retrieving the memory buffer. + const llvm::MemoryBuffer *getMemoryBufferForFile(const FileEntry *File, + bool *Invalid = 0); /// \brief Override the contents of the given source file by providing an /// already-allocated buffer. @@ -429,8 +442,9 @@ public: /// getBuffer - Return the buffer for the specified FileID. If there is an /// error opening this buffer the first time, this manufactures a temporary /// buffer and returns a non-empty error string. - const llvm::MemoryBuffer *getBuffer(FileID FID, std::string *Error = 0) const{ - return getSLocEntry(FID).getFile().getContentCache()->getBuffer(Error); + const llvm::MemoryBuffer *getBuffer(FileID FID, bool *Invalid = 0) const { + return getSLocEntry(FID).getFile().getContentCache()->getBuffer(Diag, + Invalid); } /// getFileEntryForID - Returns the FileEntry record for the provided FileID. @@ -438,9 +452,12 @@ public: return getSLocEntry(FID).getFile().getContentCache()->Entry; } - /// getBufferData - Return a pointer to the start and end of the source buffer - /// data for the specified FileID. - std::pair<const char*, const char*> getBufferData(FileID FID) const; + /// getBufferData - Return a StringRef to the source buffer data for the + /// specified FileID. + /// + /// \param FID The file ID whose contents will be returned. + /// \param Invalid If non-NULL, will be set true if an error occurred. + llvm::StringRef getBufferData(FileID FID, bool *Invalid = 0) const; //===--------------------------------------------------------------------===// @@ -558,31 +575,37 @@ public: /// getCharacterData - Return a pointer to the start of the specified location /// in the appropriate spelling MemoryBuffer. - const char *getCharacterData(SourceLocation SL) const; + /// + /// \param Invalid If non-NULL, will be set \c true if an error occurs. + const char *getCharacterData(SourceLocation SL, bool *Invalid = 0) const; /// getColumnNumber - Return the column # for the specified file position. /// This is significantly cheaper to compute than the line number. This /// returns zero if the column number isn't known. This may only be called on /// a file sloc, so you must choose a spelling or instantiation location /// before calling this method. - unsigned getColumnNumber(FileID FID, unsigned FilePos) const; - unsigned getSpellingColumnNumber(SourceLocation Loc) const; - unsigned getInstantiationColumnNumber(SourceLocation Loc) const; + unsigned getColumnNumber(FileID FID, unsigned FilePos, + bool *Invalid = 0) const; + unsigned getSpellingColumnNumber(SourceLocation Loc, + bool *Invalid = 0) const; + unsigned getInstantiationColumnNumber(SourceLocation Loc, + bool *Invalid = 0) const; /// getLineNumber - Given a SourceLocation, return the spelling line number /// for the position indicated. This requires building and caching a table of /// line offsets for the MemoryBuffer, so this is not cheap: use only when /// about to emit a diagnostic. - unsigned getLineNumber(FileID FID, unsigned FilePos) const; + unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid = 0) const; - unsigned getInstantiationLineNumber(SourceLocation Loc) const; - unsigned getSpellingLineNumber(SourceLocation Loc) const; + unsigned getInstantiationLineNumber(SourceLocation Loc, + bool *Invalid = 0) const; + unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = 0) const; /// Return the filename or buffer identifier of the buffer the location is in. /// Note that this name does not respect #line directives. Use getPresumedLoc /// for normal clients. - const char *getBufferName(SourceLocation Loc) const; + const char *getBufferName(SourceLocation Loc, bool *Invalid = 0) const; /// getFileCharacteristic - return the file characteristic of the specified /// source location, indicating whether this is a normal file, a system @@ -678,7 +701,7 @@ public: void PrintStats() const; unsigned sloc_entry_size() const { return SLocEntryTable.size(); } - + // FIXME: Exposing this is a little gross; what we want is a good way // to iterate the entries that were not defined in a PCH file (or // any other external source). @@ -692,8 +715,8 @@ public: ExternalSLocEntries->ReadSLocEntry(ID); return SLocEntryTable[ID]; } - - const SrcMgr::SLocEntry &getSLocEntry(FileID FID) const { + + const SrcMgr::SLocEntry &getSLocEntry(FileID FID) const { return getSLocEntry(FID.ID); } |