[cfe-commits] r98436 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/CodeGen/Mangle.cpp lib/Frontend/HTMLDiagnostics.cpp lib/Frontend/PrintPreprocessedOutput.cpp lib/Frontend/TextDiagnosticPrinter.cpp lib/Lex/PPDirectives.cpp lib/Lex/Preprocessor.cpp lib/Lex/TokenLexer.cpp lib/Parse/ParseDeclCXX.cpp lib/Sema/SemaExpr.cpp
Kovarththanan Rajaratnam
kovarththanan.rajaratnam at gmail.com
Sat Mar 13 02:17:05 PST 2010
Author: krj
Date: Sat Mar 13 04:17:05 2010
New Revision: 98436
URL: http://llvm.org/viewvc/llvm-project?rev=98436&view=rev
Log:
Use SmallString instead of SmallVector
Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/Lex/TokenLexer.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Sat Mar 13 04:17:05 2010
@@ -730,7 +730,7 @@
/// This code concatenates and consumes tokens up to the '>' token. It returns
/// false if the > was found, otherwise it returns true if it finds and consumes
/// the EOM marker.
- bool ConcatenateIncludeName(llvm::SmallVector<char, 128> &FilenameBuffer);
+ bool ConcatenateIncludeName(llvm::SmallString<128> &FilenameBuffer);
private:
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Sat Mar 13 04:17:05 2010
@@ -53,19 +53,19 @@
static const CXXMethodDecl *getStructor(const CXXMethodDecl *MD) {
assert((isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD)) &&
"Passed in decl is not a ctor or dtor!");
-
+
if (const TemplateDecl *TD = MD->getPrimaryTemplate()) {
MD = cast<CXXMethodDecl>(TD->getTemplatedDecl());
assert((isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD)) &&
"Templated decl is not a ctor or dtor!");
}
-
+
return MD;
}
static const unsigned UnknownArity = ~0U;
-
+
/// CXXNameMangler - Manage the mangling of a single name.
class CXXNameMangler {
MangleContext &Context;
@@ -73,7 +73,7 @@
const CXXMethodDecl *Structor;
unsigned StructorType;
-
+
llvm::DenseMap<uintptr_t, unsigned> Substitutions;
ASTContext &getASTContext() const { return Context.getASTContext(); }
@@ -92,7 +92,7 @@
~CXXNameMangler() {
if (Out.str()[0] == '\01')
return;
-
+
int status = 0;
char *result = abi::__cxa_demangle(Out.str().str().c_str(), 0, 0, &status);
assert(status == 0 && "Could not demangle mangled name!");
@@ -151,7 +151,7 @@
void mangleQualifiers(Qualifiers Quals);
void mangleObjCMethodName(const ObjCMethodDecl *MD);
-
+
// Declare manglers for every type class.
#define ABSTRACT_TYPE(CLASS, PARENT)
#define NON_CANONICAL_TYPE(CLASS, PARENT)
@@ -310,7 +310,7 @@
LinkageSpecDecl::lang_cxx && "Unexpected linkage decl!");
DC = DC->getParent();
}
-
+
return DC;
}
@@ -319,10 +319,10 @@
static bool isStdNamespace(const DeclContext *DC) {
if (!DC->isNamespace())
return false;
-
+
if (!IgnoreLinkageSpecDecls(DC->getParent())->isTranslationUnit())
return false;
-
+
return isStd(cast<NamespaceDecl>(DC));
}
@@ -353,12 +353,12 @@
// ::= <local-name>
//
const DeclContext *DC = ND->getDeclContext();
-
+
if (GetLocalClassFunctionDeclContext(DC)) {
mangleLocalName(ND);
return;
}
-
+
// If this is an extern variable declared locally, the relevant DeclContext
// is that of the containing namespace, or the translation unit.
if (isa<FunctionDecl>(DC) && ND->hasLinkage())
@@ -423,7 +423,7 @@
= dyn_cast<TemplateTemplateParmDecl>(ND)) {
mangleTemplateParameter(TTP->getIndex());
return;
- }
+ }
mangleUnscopedName(ND->getTemplatedDecl());
addSubstitution(ND);
@@ -435,7 +435,7 @@
Out << 'n';
Number = -Number;
}
-
+
Out << Number;
}
@@ -451,7 +451,7 @@
Out << '_';
return;
}
-
+
Out << 'v';
mangleNumber(Adjustment.NonVirtual);
Out << '_';
@@ -502,7 +502,7 @@
case DeclarationName::Identifier: {
if (const IdentifierInfo *II = Name.getAsIdentifierInfo()) {
// We must avoid conflicts between internally- and externally-
- // linked variable declaration names in the same TU.
+ // linked variable declaration names in the same TU.
// This naming convention is the same as that followed by GCC, though it
// shouldn't actually matter.
if (ND && isa<VarDecl>(ND) && ND->getLinkage() == InternalLinkage &&
@@ -588,7 +588,7 @@
unsigned Arity;
if (ND) {
Arity = cast<FunctionDecl>(ND)->getNumParams();
-
+
// If we have a C++ member function, we need to include the 'this' pointer.
// FIXME: This does not make sense for operators that are static, but their
// names stay the same regardless of the arity (operator new for instance).
@@ -664,26 +664,26 @@
// <discriminator> := _ <non-negative number>
const DeclContext *DC = ND->getDeclContext();
Out << 'Z';
-
+
if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC))
mangleObjCMethodName(MD);
else if (const DeclContext *CDC = GetLocalClassFunctionDeclContext(DC)) {
mangleFunctionEncoding(cast<FunctionDecl>(CDC));
Out << 'E';
mangleNestedName(ND, DC, true /*NoFunction*/);
-
+
// FIXME. This still does not cover all cases.
unsigned disc;
if (Context.getNextDiscriminator(ND, disc)) {
if (disc < 10)
Out << '_' << disc;
- else
+ else
Out << "__" << disc << '_';
}
return;
}
- else
+ else
mangleFunctionEncoding(cast<FunctionDecl>(DC));
Out << 'E';
@@ -738,7 +738,7 @@
= dyn_cast<TemplateTemplateParmDecl>(ND)) {
mangleTemplateParameter(TTP->getIndex());
return;
- }
+ }
manglePrefix(ND->getDeclContext());
mangleUnqualifiedName(ND->getTemplatedDecl());
@@ -758,22 +758,22 @@
case OO_Array_Delete: Out << "da"; break;
// ::= ps # + (unary)
// ::= pl # +
- case OO_Plus:
+ case OO_Plus:
assert((Arity == 1 || Arity == 2) && "Invalid arity!");
Out << (Arity == 1? "ps" : "pl"); break;
// ::= ng # - (unary)
// ::= mi # -
- case OO_Minus:
+ case OO_Minus:
assert((Arity == 1 || Arity == 2) && "Invalid arity!");
Out << (Arity == 1? "ng" : "mi"); break;
// ::= ad # & (unary)
// ::= an # &
- case OO_Amp:
+ case OO_Amp:
assert((Arity == 1 || Arity == 2) && "Invalid arity!");
Out << (Arity == 1? "ad" : "an"); break;
// ::= de # * (unary)
// ::= ml # *
- case OO_Star:
+ case OO_Star:
assert((Arity == 1 || Arity == 2) && "Invalid arity!");
Out << (Arity == 1? "de" : "ml"); break;
// ::= co # ~
@@ -872,15 +872,15 @@
void CXXNameMangler::mangleObjCMethodName(const ObjCMethodDecl *MD) {
llvm::SmallString<64> Name;
llvm::raw_svector_ostream OS(Name);
-
- const ObjCContainerDecl *CD =
+
+ const ObjCContainerDecl *CD =
dyn_cast<ObjCContainerDecl>(MD->getDeclContext());
assert (CD && "Missing container decl in GetNameForMethod");
OS << (MD->isInstanceMethod() ? '-' : '+') << '[' << CD->getName();
if (const ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(CD))
OS << '(' << CID->getNameAsString() << ')';
OS << ' ' << MD->getSelector().getAsString() << ']';
-
+
Out << OS.str().size() << OS.str();
}
@@ -1184,7 +1184,7 @@
void CXXNameMangler::mangleType(const DecltypeType *T) {
Expr *E = T->getUnderlyingExpr();
-
+
// type ::= Dt <expression> E # decltype of an id-expression
// # or class member access
// ::= DT <expression> E # decltype of an expression
@@ -1206,11 +1206,11 @@
Out << 'E';
}
-void CXXNameMangler::mangleIntegerLiteral(QualType T,
+void CXXNameMangler::mangleIntegerLiteral(QualType T,
const llvm::APSInt &Value) {
// <expr-primary> ::= L <type> <value number> E # integer literal
Out << 'L';
-
+
mangleType(T);
if (T->isBooleanType()) {
// Boolean values are encoded as 0/1.
@@ -1221,7 +1221,7 @@
Value.abs().print(Out, false);
}
Out << 'E';
-
+
}
void CXXNameMangler::mangleCalledExpression(const Expr *E, unsigned Arity) {
@@ -1325,7 +1325,7 @@
break;
}
- case Expr::CXXUnresolvedConstructExprClass: {
+ case Expr::CXXUnresolvedConstructExprClass: {
const CXXUnresolvedConstructExpr *CE = cast<CXXUnresolvedConstructExpr>(E);
unsigned N = CE->arg_size();
@@ -1334,7 +1334,7 @@
if (N != 1) Out << "_";
for (unsigned I = 0; I != N; ++I) mangleExpression(CE->getArg(I));
if (N != 1) Out << "E";
- break;
+ break;
}
case Expr::CXXTemporaryObjectExprClass:
@@ -1366,18 +1366,18 @@
case Expr::UnaryOperatorClass: {
const UnaryOperator *UO = cast<UnaryOperator>(E);
- mangleOperatorName(UnaryOperator::getOverloadedOperator(UO->getOpcode()),
+ mangleOperatorName(UnaryOperator::getOverloadedOperator(UO->getOpcode()),
/*Arity=*/1);
mangleExpression(UO->getSubExpr());
break;
}
-
+
case Expr::BinaryOperatorClass: {
const BinaryOperator *BO = cast<BinaryOperator>(E);
- mangleOperatorName(BinaryOperator::getOverloadedOperator(BO->getOpcode()),
+ mangleOperatorName(BinaryOperator::getOverloadedOperator(BO->getOpcode()),
/*Arity=*/2);
mangleExpression(BO->getLHS());
- mangleExpression(BO->getRHS());
+ mangleExpression(BO->getRHS());
break;
}
@@ -1407,7 +1407,7 @@
mangleExpression(ECE->getSubExpr());
break;
}
-
+
case Expr::CXXOperatorCallExprClass: {
const CXXOperatorCallExpr *CE = cast<CXXOperatorCallExpr>(E);
unsigned NumArgs = CE->getNumArgs();
@@ -1417,7 +1417,7 @@
mangleExpression(CE->getArg(i));
break;
}
-
+
case Expr::ParenExprClass:
mangleExpression(cast<ParenExpr>(E)->getSubExpr());
break;
@@ -1426,7 +1426,7 @@
const NamedDecl *D = cast<DeclRefExpr>(E)->getDecl();
switch (D->getKind()) {
- default:
+ default:
// <expr-primary> ::= L <mangled-name> E # external name
Out << 'L';
mangle(D, "_Z");
@@ -1477,7 +1477,7 @@
mangleType(FL->getType());
// TODO: avoid this copy with careful stream management.
- llvm::SmallVector<char,20> Buffer;
+ llvm::SmallString<20> Buffer;
FL->getValue().bitcastToAPInt().toString(Buffer, 16, false);
Out.write(Buffer.data(), Buffer.size());
@@ -1486,7 +1486,7 @@
}
case Expr::IntegerLiteralClass:
- mangleIntegerLiteral(E->getType(),
+ mangleIntegerLiteral(E->getType(),
llvm::APSInt(cast<IntegerLiteral>(E)->getValue()));
break;
@@ -1568,7 +1568,7 @@
assert(A.getAsTemplate().getAsTemplateDecl() &&
"FIXME: Support dependent template names");
mangleName(A.getAsTemplate().getAsTemplateDecl());
- break;
+ break;
case TemplateArgument::Expression:
Out << 'X';
mangleExpression(A.getAsExpr());
@@ -1718,20 +1718,20 @@
const char (&Str)[StrLen]) {
if (!SD->getIdentifier()->isStr(Str))
return false;
-
+
const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
if (TemplateArgs.size() != 2)
return false;
-
+
if (!isCharType(TemplateArgs[0].getAsType()))
return false;
-
+
if (!isCharSpecialization(TemplateArgs[1].getAsType(), "char_traits"))
return false;
-
+
return true;
}
-
+
bool CXXNameMangler::mangleStandardSubstitution(const NamedDecl *ND) {
// <substitution> ::= St # ::std::
if (const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) {
@@ -1798,7 +1798,7 @@
Out << "So";
return true;
}
-
+
// <substitution> ::= Sd # ::std::basic_iostream<char,
// ::std::char_traits<char> >
if (isStreamCharSpecialization(SD, "basic_iostream")) {
@@ -1867,7 +1867,7 @@
/// \brief Mangles the a thunk with the offset n for the declaration D and
/// emits that name to the given output stream.
-void MangleContext::mangleThunk(const FunctionDecl *FD,
+void MangleContext::mangleThunk(const FunctionDecl *FD,
const ThunkAdjustment &ThisAdjustment,
llvm::SmallVectorImpl<char> &Res) {
assert(!isa<CXXDestructorDecl>(FD) &&
@@ -1895,7 +1895,7 @@
/// \brief Mangles the a covariant thunk for the declaration D and emits that
/// name to the given output stream.
-void
+void
MangleContext::mangleCovariantThunk(const FunctionDecl *FD,
const CovariantThunkAdjustment& Adjustment,
llvm::SmallVectorImpl<char> &Res) {
Modified: cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp Sat Mar 13 04:17:05 2010
@@ -40,13 +40,13 @@
std::vector<const PathDiagnostic*> BatchedDiags;
public:
HTMLDiagnostics(const std::string& prefix, const Preprocessor &pp);
-
+
virtual ~HTMLDiagnostics() { FlushDiagnostics(NULL); }
-
+
virtual void FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade);
virtual void HandlePathDiagnostic(const PathDiagnostic* D);
-
+
virtual llvm::StringRef getName() const {
return "HTMLDiagnostics";
}
@@ -108,7 +108,7 @@
ReportDiag(*D, FilesMade);
delete D;
}
-
+
BatchedDiags.clear();
}
@@ -294,7 +294,7 @@
llvm::raw_fd_ostream os(H.c_str(), ErrorMsg);
if (!ErrorMsg.empty()) {
- (llvm::errs() << "warning: could not create file '" << F.str()
+ (llvm::errs() << "warning: could not create file '" << F.str()
<< "'\n").flush();
return;
}
@@ -502,7 +502,7 @@
}
static void EmitAlphaCounter(llvm::raw_ostream& os, unsigned n) {
- llvm::SmallVector<char, 10> buf;
+ llvm::SmallString<10> buf;
do {
unsigned x = n % ('z' - 'a');
Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Sat Mar 13 04:17:05 2010
@@ -61,7 +61,7 @@
if (MI.tokens_empty() || !MI.tokens_begin()->hasLeadingSpace())
OS << ' ';
- llvm::SmallVector<char, 128> SpellingBuffer;
+ llvm::SmallString<128> SpellingBuffer;
for (MacroInfo::tokens_iterator I = MI.tokens_begin(), E = MI.tokens_end();
I != E; ++I) {
if (I->hasLeadingSpace())
Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sat Mar 13 04:17:05 2010
@@ -119,19 +119,19 @@
}
assert(StartColNo <= EndColNo && "Invalid range!");
-
+
// Pick the first non-whitespace column.
while (StartColNo < SourceLine.size() &&
(SourceLine[StartColNo] == ' ' || SourceLine[StartColNo] == '\t'))
++StartColNo;
-
+
// Pick the last non-whitespace column.
if (EndColNo > SourceLine.size())
EndColNo = SourceLine.size();
while (EndColNo-1 &&
(SourceLine[EndColNo-1] == ' ' || SourceLine[EndColNo-1] == '\t'))
--EndColNo;
-
+
// If the start/end passed each other, then we are trying to highlight a range
// that just exists in whitespace, which must be some sort of other bug.
assert(StartColNo <= EndColNo && "Trying to highlight whitespace??");
@@ -300,10 +300,10 @@
if (E.isMacroID()) E = SM.getImmediateSpellingLoc(E);
Ranges[i] = SourceRange(S, E);
}
-
+
// Get the pretty name, according to #line directives etc.
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
-
+
// If this diagnostic is not in the main file, print out the "included from"
// lines.
if (LastWarningLoc != PLoc.getIncludeLoc()) {
@@ -563,7 +563,7 @@
// We have the start of a balanced punctuation sequence (quotes,
// parentheses, etc.). Determine the full sequence is.
- llvm::SmallVector<char, 16> PunctuationEndStack;
+ llvm::SmallString<16> PunctuationEndStack;
PunctuationEndStack.push_back(EndPunct);
while (End < Length && !PunctuationEndStack.empty()) {
if (Str[End] == PunctuationEndStack.back())
@@ -704,7 +704,7 @@
if (DiagOpts->ShowLocation) {
if (DiagOpts->ShowColors)
OS.changeColor(savedColor, true);
-
+
// Emit a Visual Studio compatible line number syntax.
if (LangOpts && LangOpts->Microsoft) {
OS << PLoc.getFilename() << '(' << LineNo << ')';
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Sat Mar 13 04:17:05 2010
@@ -471,7 +471,7 @@
CurPPLexer->ParsingPreprocessorDirective = true;
++NumDirectives;
-
+
// We are about to read a token. For the multiple-include optimization FA to
// work, we have to remember if we had read any tokens *before* this
// pp-directive.
@@ -964,7 +964,7 @@
/// false if the > was found, otherwise it returns true if it finds and consumes
/// the EOM marker.
bool Preprocessor::ConcatenateIncludeName(
- llvm::SmallVector<char, 128> &FilenameBuffer) {
+ llvm::SmallString<128> &FilenameBuffer) {
Token CurTok;
Lex(CurTok);
@@ -1042,7 +1042,7 @@
return;
}
- bool isAngled =
+ bool isAngled =
GetIncludeFilenameSpelling(FilenameTok.getLocation(), Filename);
// If GetIncludeFilenameSpelling set the start ptr to null, there was an
// error.
@@ -1070,7 +1070,7 @@
Diag(FilenameTok, diag::err_pp_file_not_found) << Filename;
return;
}
-
+
// Ask HeaderInfo if we should enter this #include file. If not, #including
// this file will have no effect.
if (!HeaderInfo.ShouldEnterIncludeFile(File, isImport))
@@ -1512,7 +1512,7 @@
IdentifierInfo *MII = MacroNameTok.getIdentifierInfo();
MacroInfo *MI = getMacroInfo(MII);
-
+
if (CurPPLexer->getConditionalStackDepth() == 0) {
// If the start of a top-level #ifdef and if the macro is not defined,
// inform MIOpt that this might be the start of a proper include guard.
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Sat Mar 13 04:17:05 2010
@@ -52,7 +52,7 @@
bool OwnsHeaders)
: Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()),
SourceMgr(SM), HeaderInfo(Headers), ExternalSource(0),
- Identifiers(opts, IILookup), BuiltinInfo(Target), CodeCompletionFile(0),
+ Identifiers(opts, IILookup), BuiltinInfo(Target), CodeCompletionFile(0),
CurPPLexer(0), CurDirLookup(0), Callbacks(0), MacroArgCache(0) {
ScratchBuf = new ScratchBuffer(SourceMgr);
CounterValue = 0; // __COUNTER__ starts at 0.
@@ -80,7 +80,7 @@
// We haven't read anything from the external source.
ReadMacrosFromExternalSource = false;
-
+
// "Poison" __VA_ARGS__, which can only appear in the expansion of a macro.
// This gets unpoisoned where it is allowed.
(Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned();
@@ -116,7 +116,7 @@
// Free any cached macro expanders.
for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i)
delete TokenLexerCache[i];
-
+
// Free any cached MacroArgs.
for (MacroArgs *ArgList = MacroArgCache; ArgList; )
ArgList = ArgList->deallocate();
@@ -198,30 +198,30 @@
<< NumFastTokenPaste << " on the fast path.\n";
}
-Preprocessor::macro_iterator
-Preprocessor::macro_begin(bool IncludeExternalMacros) const {
- if (IncludeExternalMacros && ExternalSource &&
+Preprocessor::macro_iterator
+Preprocessor::macro_begin(bool IncludeExternalMacros) const {
+ if (IncludeExternalMacros && ExternalSource &&
!ReadMacrosFromExternalSource) {
ReadMacrosFromExternalSource = true;
ExternalSource->ReadDefinedMacros();
}
-
- return Macros.begin();
+
+ return Macros.begin();
}
-Preprocessor::macro_iterator
-Preprocessor::macro_end(bool IncludeExternalMacros) const {
- if (IncludeExternalMacros && ExternalSource &&
+Preprocessor::macro_iterator
+Preprocessor::macro_end(bool IncludeExternalMacros) const {
+ if (IncludeExternalMacros && ExternalSource &&
!ReadMacrosFromExternalSource) {
ReadMacrosFromExternalSource = true;
ExternalSource->ReadDefinedMacros();
}
-
- return Macros.end();
+
+ return Macros.end();
}
-bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File,
- unsigned TruncateAtLine,
+bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File,
+ unsigned TruncateAtLine,
unsigned TruncateAtColumn) {
using llvm::MemoryBuffer;
@@ -242,7 +242,7 @@
for (; *Position; ++Position) {
if (*Position != '\r' && *Position != '\n')
continue;
-
+
// Eat \r\n or \n\r as a single line.
if ((Position[1] == '\r' || Position[1] == '\n') &&
Position[0] != Position[1])
@@ -251,13 +251,13 @@
break;
}
}
-
+
Position += TruncateAtColumn - 1;
-
+
// Truncate the buffer.
if (Position < Buffer->getBufferEnd()) {
- MemoryBuffer *TruncatedBuffer
- = MemoryBuffer::getMemBufferCopy(Buffer->getBufferStart(), Position,
+ MemoryBuffer *TruncatedBuffer
+ = MemoryBuffer::getMemBufferCopy(Buffer->getBufferStart(), Position,
Buffer->getBufferIdentifier());
SourceMgr.overrideFileContents(File, TruncatedBuffer);
}
@@ -446,7 +446,7 @@
return TokStart.getFileLocWithOffset(PhysOffset);
}
-SourceLocation Preprocessor::getLocForEndOfToken(SourceLocation Loc,
+SourceLocation Preprocessor::getLocForEndOfToken(SourceLocation Loc,
unsigned Offset) {
if (Loc.isInvalid() || !Loc.isFileID())
return SourceLocation();
@@ -456,7 +456,7 @@
Len = Len - Offset;
else
return Loc;
-
+
return AdvanceToTokenCharacter(Loc, Len);
}
@@ -519,7 +519,7 @@
II = getIdentifierInfo(llvm::StringRef(BufPtr, Identifier.getLength()));
} else {
// Cleaning needed, alloca a buffer, clean into it, then use the buffer.
- llvm::SmallVector<char, 64> IdentifierBuffer;
+ llvm::SmallString<64> IdentifierBuffer;
llvm::StringRef CleanedStr = getSpelling(Identifier, IdentifierBuffer);
II = getIdentifierInfo(CleanedStr);
}
Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Sat Mar 13 04:17:05 2010
@@ -379,7 +379,7 @@
/// are more ## after it, chomp them iteratively. Return the result as Tok.
/// If this returns true, the caller should immediately return the token.
bool TokenLexer::PasteTokens(Token &Tok) {
- llvm::SmallVector<char, 128> Buffer;
+ llvm::SmallString<128> Buffer;
const char *ResultTokStrPtr = 0;
do {
// Consume the ## operator.
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sat Mar 13 04:17:05 2010
@@ -52,7 +52,7 @@
Actions.CodeCompleteNamespaceDecl(CurScope);
ConsumeToken();
}
-
+
SourceLocation IdentLoc;
IdentifierInfo *Ident = 0;
@@ -130,7 +130,7 @@
Actions.CodeCompleteNamespaceAliasDecl(CurScope);
ConsumeToken();
}
-
+
CXXScopeSpec SS;
// Parse (optional) nested-name-specifier.
ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false);
@@ -165,7 +165,7 @@
Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
unsigned Context) {
assert(Tok.is(tok::string_literal) && "Not a string literal!");
- llvm::SmallVector<char, 8> LangBuffer;
+ llvm::SmallString<8> LangBuffer;
// LangBuffer is guaranteed to be big enough.
llvm::StringRef Lang = PP.getSpelling(Tok, LangBuffer);
@@ -183,7 +183,7 @@
if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) {
Attr = ParseCXX0XAttributes();
}
-
+
if (Tok.isNot(tok::l_brace)) {
ParseDeclarationOrFunctionDefinition(DS, Attr.AttrList);
return Actions.ActOnFinishLinkageSpecification(CurScope, LinkageSpec,
@@ -222,7 +222,7 @@
Actions.CodeCompleteUsing(CurScope);
ConsumeToken();
}
-
+
if (Tok.is(tok::kw_namespace))
// Next token after 'using' is 'namespace' so it must be using-directive
return ParseUsingDirective(Context, UsingLoc, DeclEnd, Attr.AttrList);
@@ -259,7 +259,7 @@
Actions.CodeCompleteUsingDirective(CurScope);
ConsumeToken();
}
-
+
CXXScopeSpec SS;
// Parse (optional) nested-name-specifier.
ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false);
@@ -332,20 +332,20 @@
return DeclPtrTy();
}
- // Parse the unqualified-id. We allow parsing of both constructor and
+ // Parse the unqualified-id. We allow parsing of both constructor and
// destructor names and allow the action module to diagnose any semantic
// errors.
UnqualifiedId Name;
- if (ParseUnqualifiedId(SS,
+ if (ParseUnqualifiedId(SS,
/*EnteringContext=*/false,
/*AllowDestructorName=*/true,
- /*AllowConstructorName=*/true,
- /*ObjectType=*/0,
+ /*AllowConstructorName=*/true,
+ /*ObjectType=*/0,
Name)) {
SkipUntil(tok::semi);
return DeclPtrTy();
}
-
+
// Parse (optional) attributes (most likely GNU strong-using extension).
llvm::OwningPtr<AttributeList> AttrList;
if (Tok.is(tok::kw___attribute))
@@ -354,7 +354,7 @@
// Eat ';'.
DeclEnd = Tok.getLocation();
ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
- AttrList ? "attributes list" : "using declaration",
+ AttrList ? "attributes list" : "using declaration",
tok::semi);
return Actions.ActOnUsingDeclaration(CurScope, AS, true, UsingLoc, SS, Name,
@@ -502,26 +502,26 @@
Diag(IdLoc, diag::err_unknown_template_name)
<< Id;
}
-
+
if (!Template)
return true;
- // Form the template name
+ // Form the template name
UnqualifiedId TemplateName;
TemplateName.setIdentifier(Id, IdLoc);
-
+
// Parse the full template-id, then turn it into a type.
if (AnnotateTemplateIdToken(Template, TNK, SS, TemplateName,
SourceLocation(), true))
return true;
if (TNK == TNK_Dependent_template_name)
AnnotateTemplateIdTokenAsType(SS);
-
+
// If we didn't end up with a typename token, there's nothing more we
// can do.
if (Tok.isNot(tok::annot_typename))
return true;
-
+
// Retrieve the type from the annotation token, consume that token, and
// return.
EndLocation = Tok.getAnnotationEndLoc();
@@ -532,7 +532,7 @@
// We have an identifier; check whether it is actually a type.
TypeTy *Type = Actions.getTypeName(*Id, IdLoc, CurScope, SS, true);
- if (!Type) {
+ if (!Type) {
Diag(IdLoc, diag::err_expected_class_name);
return true;
}
@@ -601,7 +601,7 @@
Actions.CodeCompleteTag(CurScope, TagType);
ConsumeToken();
}
-
+
AttributeList *AttrList = 0;
// If attributes exist after tag, parse them.
if (Tok.is(tok::kw___attribute))
@@ -610,7 +610,7 @@
// If declspecs exist after tag, parse them.
if (Tok.is(tok::kw___declspec))
AttrList = ParseMicrosoftDeclSpec(AttrList);
-
+
// If C++0x attributes exist here, parse them.
// FIXME: Are we consistent with the ordering of parsing of different
// styles of attributes?
@@ -642,7 +642,7 @@
if (getLang().CPlusPlus) {
// "FOO : BAR" is not a potential typo for "FOO::BAR".
ColonProtectionRAIIObject X(*this);
-
+
ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, true);
if (SS.isSet())
if (Tok.isNot(tok::identifier) && Tok.isNot(tok::annot_template_id))
@@ -658,21 +658,21 @@
if (Tok.is(tok::identifier)) {
Name = Tok.getIdentifierInfo();
NameLoc = ConsumeToken();
-
+
if (Tok.is(tok::less)) {
- // The name was supposed to refer to a template, but didn't.
+ // The name was supposed to refer to a template, but didn't.
// Eat the template argument list and try to continue parsing this as
// a class (or template thereof).
TemplateArgList TemplateArgs;
SourceLocation LAngleLoc, RAngleLoc;
- if (ParseTemplateIdAfterTemplateName(TemplateTy(), NameLoc, &SS,
+ if (ParseTemplateIdAfterTemplateName(TemplateTy(), NameLoc, &SS,
true, LAngleLoc,
TemplateArgs, RAngleLoc)) {
// We couldn't parse the template argument list at all, so don't
// try to give any location information for the list.
LAngleLoc = RAngleLoc = SourceLocation();
}
-
+
Diag(NameLoc, diag::err_explicit_spec_non_template)
<< (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
<< (TagType == DeclSpec::TST_class? 0
@@ -680,30 +680,30 @@
: 2)
<< Name
<< SourceRange(LAngleLoc, RAngleLoc);
-
- // Strip off the last template parameter list if it was empty, since
+
+ // Strip off the last template parameter list if it was empty, since
// we've removed its template argument list.
if (TemplateParams && TemplateInfo.LastParameterListWasEmpty) {
if (TemplateParams && TemplateParams->size() > 1) {
TemplateParams->pop_back();
} else {
TemplateParams = 0;
- const_cast<ParsedTemplateInfo&>(TemplateInfo).Kind
+ const_cast<ParsedTemplateInfo&>(TemplateInfo).Kind
= ParsedTemplateInfo::NonTemplate;
}
} else if (TemplateInfo.Kind
== ParsedTemplateInfo::ExplicitInstantiation) {
// Pretend this is just a forward declaration.
TemplateParams = 0;
- const_cast<ParsedTemplateInfo&>(TemplateInfo).Kind
+ const_cast<ParsedTemplateInfo&>(TemplateInfo).Kind
= ParsedTemplateInfo::NonTemplate;
- const_cast<ParsedTemplateInfo&>(TemplateInfo).TemplateLoc
+ const_cast<ParsedTemplateInfo&>(TemplateInfo).TemplateLoc
= SourceLocation();
const_cast<ParsedTemplateInfo&>(TemplateInfo).ExternLoc
= SourceLocation();
}
-
-
+
+
}
} else if (Tok.is(tok::annot_template_id)) {
TemplateId = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
@@ -896,7 +896,7 @@
// less common call.
if (IsDependent)
TypeResult = Actions.ActOnDependentTag(CurScope, TagType, TUK,
- SS, Name, StartLoc, NameLoc);
+ SS, Name, StartLoc, NameLoc);
}
// If there is a body, parse it and inform the actions module.
@@ -927,11 +927,11 @@
// FIXME: The DeclSpec should keep the locations of both the keyword and the
// name (if there is one).
SourceLocation TSTLoc = NameLoc.isValid()? NameLoc : StartLoc;
-
+
if (DS.SetTypeSpecType(TagType, TSTLoc, PrevSpec, DiagID,
Result, Owned))
Diag(StartLoc, DiagID) << PrevSpec;
-
+
// At this point, we've successfully parsed a class-specifier in 'definition'
// form (e.g. "struct foo { int x; }". While we could just return here, we're
// going to look at what comes after it to improve error recovery. If an
@@ -984,14 +984,14 @@
if (!isKnownToBeTypeSpecifier(NextToken()))
ExpectedSemi = false;
break;
-
- case tok::r_brace: // struct bar { struct foo {...} }
+
+ case tok::r_brace: // struct bar { struct foo {...} }
// Missing ';' at end of struct is accepted as an extension in C mode.
if (!getLang().CPlusPlus)
ExpectedSemi = false;
break;
}
-
+
if (ExpectedSemi) {
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
TagType == DeclSpec::TST_class ? "class"
@@ -1000,7 +1000,7 @@
// to ';' so that the rest of the code recovers as though there were an
// ';' after the definition.
PP.EnterToken(Tok);
- Tok.setKind(tok::semi);
+ Tok.setKind(tok::semi);
}
}
}
@@ -1084,7 +1084,7 @@
// Parse optional '::' and optional nested-name-specifier.
CXXScopeSpec SS;
- ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0,
+ ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0,
/*EnteringContext=*/false);
// The location of the base class itself.
@@ -1251,7 +1251,7 @@
// Don't parse FOO:BAR as if it were a typo for FOO::BAR, in this context it
// is a bitfield.
ColonProtectionRAIIObject X(*this);
-
+
CXX0XAttributeList AttrList;
// Optional C++0x attribute-specifier
if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier())
@@ -1259,7 +1259,7 @@
if (Tok.is(tok::kw_using)) {
// FIXME: Check for template aliases
-
+
if (AttrList.HasAttr)
Diag(AttrList.Range.getBegin(), diag::err_attributes_not_allowed)
<< AttrList.Range;
@@ -1628,14 +1628,14 @@
llvm::SmallVector<MemInitTy*, 4> MemInitializers;
bool AnyErrors = false;
-
+
do {
MemInitResult MemInit = ParseMemInitializer(ConstructorDecl);
if (!MemInit.isInvalid())
MemInitializers.push_back(MemInit.get());
else
AnyErrors = true;
-
+
if (Tok.is(tok::comma))
ConsumeToken();
else if (Tok.is(tok::l_brace))
@@ -1869,7 +1869,7 @@
ConsumeBracket();
ConsumeBracket();
-
+
if (Tok.is(tok::comma)) {
Diag(Tok.getLocation(), diag::err_expected_ident);
ConsumeToken();
@@ -1884,7 +1884,7 @@
IdentifierInfo *ScopeName = 0, *AttrName = Tok.getIdentifierInfo();
SourceLocation ScopeLoc, AttrLoc = ConsumeToken();
-
+
// scoped attribute
if (Tok.is(tok::coloncolon)) {
ConsumeToken();
@@ -1894,7 +1894,7 @@
SkipUntil(tok::r_square, tok::comma, true, true);
continue;
}
-
+
ScopeName = AttrName;
ScopeLoc = AttrLoc;
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=98436&r1=98435&r2=98436&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Mar 13 04:17:05 2010
@@ -58,7 +58,7 @@
Diag(Loc, diag::warn_unavailable) << D->getDeclName();
Diag(D->getLocation(), diag::note_unavailable_here) << 0;
}
-
+
// See if this is a deleted function.
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
if (FD->isDeleted()) {
@@ -202,7 +202,7 @@
void Sema::DefaultFunctionArrayLvalueConversion(Expr *&E) {
DefaultFunctionArrayConversion(E);
-
+
QualType Ty = E->getType();
assert(!Ty.isNull() && "DefaultFunctionArrayLvalueConversion - missing type");
if (!Ty->isDependentType() && Ty.hasQualifiers() &&
@@ -214,8 +214,8 @@
// rvalue is T
//
// C99 6.3.2.1p2:
- // If the lvalue has qualified type, the value has the unqualified
- // version of the type of the lvalue; otherwise, the value has the
+ // If the lvalue has qualified type, the value has the unqualified
+ // version of the type of the lvalue; otherwise, the value has the
// type of the lvalue.
ImpCastExprToType(E, Ty.getUnqualifiedType(), CastExpr::CK_NoOp);
}
@@ -289,7 +289,7 @@
return true;
if (!Expr->getType()->isPODType() &&
- DiagRuntimeBehavior(Expr->getLocStart(),
+ DiagRuntimeBehavior(Expr->getLocStart(),
PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
<< Expr->getType() << CT))
return true;
@@ -423,10 +423,10 @@
// all get the bit). Walk the nesting chain.
for (unsigned I = S.FunctionScopes.size() - 1; I; --I) {
BlockScopeInfo *NextBlock = dyn_cast<BlockScopeInfo>(S.FunctionScopes[I]);
-
+
if (!NextBlock)
continue;
-
+
// If we found the defining block for the variable, don't mark the block as
// having a reference outside it.
if (NextBlock->TheDecl == VD->getDeclContext())
@@ -469,9 +469,9 @@
MarkDeclarationReferenced(Loc, D);
- return Owned(DeclRefExpr::Create(Context,
- SS? (NestedNameSpecifier *)SS->getScopeRep() : 0,
- SS? SS->getRange() : SourceRange(),
+ return Owned(DeclRefExpr::Create(Context,
+ SS? (NestedNameSpecifier *)SS->getScopeRep() : 0,
+ SS? SS->getRange() : SourceRange(),
D, Loc, Ty));
}
@@ -768,14 +768,14 @@
return true;
}
-
+
/// Determines if this is an instance member of a class.
static bool IsInstanceMember(NamedDecl *D) {
assert(D->isCXXClassMember() &&
"checking whether non-member is instance member");
if (isa<FieldDecl>(D)) return true;
-
+
if (isa<CXXMethodDecl>(D))
return !cast<CXXMethodDecl>(D)->isStatic();
@@ -971,7 +971,7 @@
Diag(R.getNameLoc(), diagnostic_suggest) << Name << R.getLookupName()
<< CodeModificationHint::CreateReplacement(R.getNameLoc(),
R.getLookupName().getAsString());
- else
+ else
Diag(R.getNameLoc(), diag::err_no_member_suggest)
<< Name << computeDeclContext(SS, false) << R.getLookupName()
<< SS.getRange()
@@ -980,7 +980,7 @@
if (NamedDecl *ND = R.getAsSingle<NamedDecl>())
Diag(ND->getLocation(), diag::note_previous_decl)
<< ND->getDeclName();
-
+
// Tell the callee to try to recover.
return false;
}
@@ -993,7 +993,7 @@
// to recover well anyway.
if (SS.isEmpty())
Diag(R.getNameLoc(), diagnostic_suggest) << Name << R.getLookupName();
- else
+ else
Diag(R.getNameLoc(), diag::err_no_member_suggest)
<< Name << computeDeclContext(SS, false) << R.getLookupName()
<< SS.getRange();
@@ -1107,7 +1107,7 @@
// If we found an Objective-C instance variable, let
// LookupInObjCMethod build the appropriate expression to
- // reference the ivar.
+ // reference the ivar.
if (ObjCIvarDecl *Ivar = R.getAsSingle<ObjCIvarDecl>()) {
R.clear();
OwningExprResult E(LookupInObjCMethod(R, S, Ivar->getIdentifier()));
@@ -1303,7 +1303,7 @@
// turn this into Self->ivar, just return a BareIVarExpr or something.
IdentifierInfo &II = Context.Idents.get("self");
UnqualifiedId SelfName;
- SelfName.setIdentifier(&II, SourceLocation());
+ SelfName.setIdentifier(&II, SourceLocation());
CXXScopeSpec SelfScopeSpec;
OwningExprResult SelfExpr = ActOnIdExpression(S, SelfScopeSpec,
SelfName, false, false);
@@ -1326,7 +1326,7 @@
// Needed to implement property "super.method" notation.
if (Lookup.empty() && II->isStr("super")) {
QualType T;
-
+
if (getCurMethodDecl()->isInstanceMethod())
T = Context.getObjCObjectPointerType(Context.getObjCInterfaceType(
getCurMethodDecl()->getClassInterface()));
@@ -1363,7 +1363,7 @@
CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Member->getDeclContext());
if (!RD)
return false;
-
+
QualType DestRecordType;
QualType DestType;
QualType FromRecordType;
@@ -1371,7 +1371,7 @@
bool PointerConversions = false;
if (isa<FieldDecl>(Member)) {
DestRecordType = Context.getCanonicalType(Context.getTypeDeclType(RD));
-
+
if (FromType->getAs<PointerType>()) {
DestType = Context.getPointerType(DestRecordType);
FromRecordType = FromType->getPointeeType();
@@ -1383,10 +1383,10 @@
} else if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Member)) {
if (Method->isStatic())
return false;
-
+
DestType = Method->getThisType(Context);
DestRecordType = DestType->getPointeeType();
-
+
if (FromType->getAs<PointerType>()) {
FromRecordType = FromType->getPointeeType();
PointerConversions = true;
@@ -1398,16 +1398,16 @@
// No conversion necessary.
return false;
}
-
+
if (DestType->isDependentType() || FromType->isDependentType())
return false;
-
+
// If the unqualified types are the same, no conversion is necessary.
if (Context.hasSameUnqualifiedType(FromRecordType, DestRecordType))
return false;
-
+
// C++ [class.member.lookup]p8:
- // [...] Ambiguities can often be resolved by qualifying a name with its
+ // [...] Ambiguities can often be resolved by qualifying a name with its
// class name.
//
// If the member was a qualified name and the qualified referred to a
@@ -1435,7 +1435,7 @@
IntermediateType = Context.getPointerType(IntermediateType);
}
}
-
+
if (!IntermediateType.isNull() &&
IsDerivedFrom(FromRecordType, IntermediateRecordType) &&
IsDerivedFrom(IntermediateRecordType, DestRecordType)) {
@@ -1448,18 +1448,18 @@
return true;
ImpCastExprToType(From, IntermediateType, CastExpr::CK_DerivedToBase,
- /*isLvalue=*/!PointerConversions);
+ /*isLvalue=*/!PointerConversions);
ImpCastExprToType(From, DestType, CastExpr::CK_DerivedToBase,
/*isLvalue=*/!PointerConversions);
return false;
}
-
+
if (CheckDerivedToBaseConversion(FromRecordType,
DestRecordType,
From->getSourceRange().getBegin(),
From->getSourceRange()))
return true;
-
+
ImpCastExprToType(From, DestType, CastExpr::CK_DerivedToBase,
/*isLvalue=*/true);
return false;
@@ -1633,7 +1633,7 @@
return Owned(ULE);
}
-
+
/// \brief Complete semantic analysis for a reference to the given declaration.
Sema::OwningExprResult
@@ -1658,7 +1658,7 @@
// Make sure that we're referring to a value.
ValueDecl *VD = dyn_cast<ValueDecl>(D);
if (!VD) {
- Diag(Loc, diag::err_ref_non_value)
+ Diag(Loc, diag::err_ref_non_value)
<< D << SS.getRange();
Diag(D->getLocation(), diag::note_declared_at);
return ExprError();
@@ -1683,7 +1683,7 @@
// We do not do this for things like enum constants, global variables, etc,
// as they do not get snapshotted.
//
- if (getCurBlock() &&
+ if (getCurBlock() &&
ShouldSnapshotBlockValueReference(*this, getCurBlock(), VD)) {
if (VD->getType().getTypePtr()->isVariablyModifiedType()) {
Diag(Loc, diag::err_ref_vm_type);
@@ -1819,7 +1819,7 @@
if ((result & APFloat::opOverflow) ||
((result & APFloat::opUnderflow) && Val.isZero())) {
unsigned diagnostic;
- llvm::SmallVector<char, 20> buffer;
+ llvm::SmallString<20> buffer;
if (result & APFloat::opOverflow) {
diagnostic = diag::warn_float_overflow;
APFloat::getLargest(Format).toString(buffer);
@@ -2531,7 +2531,7 @@
}
assert(DC && "Cannot handle non-computable dependent contexts in lookup");
-
+
if (!isa<TypeDecl>(DC)) {
SemaRef.Diag(R.getNameLoc(), diag::err_qualified_member_nonclass)
<< DC << SS.getRange();
@@ -2548,7 +2548,7 @@
// We didn't find anything with the given name, so try to correct
// for typos.
DeclarationName Name = R.getLookupName();
- if (SemaRef.CorrectTypo(R, 0, &SS, DC) &&
+ if (SemaRef.CorrectTypo(R, 0, &SS, DC) &&
(isa<ValueDecl>(*R.begin()) || isa<FunctionTemplateDecl>(*R.begin()))) {
SemaRef.Diag(R.getNameLoc(), diag::err_no_member_suggest)
<< Name << DC << R.getLookupName() << SS.getRange()
@@ -2685,7 +2685,7 @@
return Owned(MemExpr);
}
- assert(R.isSingleResult());
+ assert(R.isSingleResult());
NamedDecl *MemberDecl = R.getFoundDecl();
// FIXME: diagnose the presence of template arguments now.
@@ -2831,13 +2831,13 @@
Diag(Loc, diag::err_member_reference_needs_call)
<< QualType(Fun, 0)
<< CodeModificationHint::CreateInsertion(Loc, "()");
-
+
OwningExprResult NewBase
- = ActOnCallExpr(0, ExprArg(*this, BaseExpr), Loc,
+ = ActOnCallExpr(0, ExprArg(*this, BaseExpr), Loc,
MultiExprArg(*this, 0, 0), 0, Loc);
if (NewBase.isInvalid())
return ExprError();
-
+
BaseExpr = NewBase.takeAs<Expr>();
DefaultFunctionArrayConversion(BaseExpr);
BaseType = BaseExpr->getType();
@@ -2907,20 +2907,20 @@
// Look through local category implementations associated with the class.
if (!Setter)
Setter = IFace->getCategoryClassMethod(SetterSel);
-
+
if (Setter && DiagnoseUseOfDecl(Setter, MemberLoc))
return ExprError();
-
+
if (Getter || Setter) {
QualType PType;
-
+
if (Getter)
PType = Getter->getResultType();
else
// Get the expression type from Setter's incoming parameter.
PType = (*(Setter->param_end() -1))->getType();
// FIXME: we must check that the setter has property type.
- return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(Getter,
+ return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(Getter,
PType,
Setter, MemberLoc, BaseExpr));
}
@@ -2928,7 +2928,7 @@
<< MemberName << BaseType);
}
}
-
+
if (BaseType->isObjCClassType() &&
BaseType != Context.ObjCClassRedefinitionType) {
BaseType = Context.ObjCClassRedefinitionType;
@@ -2975,7 +2975,7 @@
}
}
}
-
+
// Handle field access to simple records. This also handles access
// to fields of the ObjC 'id' struct.
if (const RecordType *RTy = BaseType->getAs<RecordType>()) {
@@ -3005,13 +3005,13 @@
LookupMemberName);
if (CorrectTypo(Res, 0, 0, IDecl) &&
(IV = Res.getAsSingle<ObjCIvarDecl>())) {
- Diag(R.getNameLoc(),
+ Diag(R.getNameLoc(),
diag::err_typecheck_member_reference_ivar_suggest)
<< IDecl->getDeclName() << MemberName << IV->getDeclName()
<< CodeModificationHint::CreateReplacement(R.getNameLoc(),
IV->getNameAsString());
Diag(IV->getLocation(), diag::note_previous_decl)
- << IV->getDeclName();
+ << IV->getDeclName();
}
}
@@ -3179,7 +3179,7 @@
// Attempt to correct for typos in property names.
LookupResult Res(*this, R.getLookupName(), R.getNameLoc(),
LookupOrdinaryName);
- if (CorrectTypo(Res, 0, 0, IFace, false, OPT) &&
+ if (CorrectTypo(Res, 0, 0, IFace, false, OPT) &&
Res.getAsSingle<ObjCPropertyDecl>()) {
Diag(R.getNameLoc(), diag::err_property_not_found_suggest)
<< MemberName << BaseType << Res.getLookupName()
@@ -3187,7 +3187,7 @@
Res.getLookupName().getAsString());
ObjCPropertyDecl *Property = Res.getAsSingle<ObjCPropertyDecl>();
Diag(Property->getLocation(), diag::note_previous_decl)
- << Property->getDeclName();
+ << Property->getDeclName();
return LookupMemberExpr(Res, BaseExpr, IsArrow, OpLoc, SS,
ObjCImpDecl);
@@ -3216,7 +3216,7 @@
return Owned(new (Context) ExtVectorElementExpr(ret, BaseExpr, *Member,
MemberLoc));
}
-
+
Diag(MemberLoc, diag::err_typecheck_member_reference_struct_union)
<< BaseType << BaseExpr->getSourceRange();
@@ -3341,11 +3341,11 @@
Expr *ResultE = Result.takeAs<Expr>();
InitializationSequence InitSeq(*this, Entity, Kind, &ResultE, 1);
- Result = InitSeq.Perform(*this, Entity, Kind,
+ Result = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, (void**)&ResultE, 1));
if (Result.isInvalid())
return ExprError();
-
+
// Build the default argument expression.
return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param,
Result.takeAs<Expr>()));
@@ -3380,7 +3380,7 @@
// assignment, to the types of the corresponding parameter, ...
unsigned NumArgsInProto = Proto->getNumArgs();
bool Invalid = false;
-
+
// If too few arguments are available (and we don't have default
// arguments for the remaining parameters), don't make the call.
if (NumArgs < NumArgsInProto) {
@@ -3405,7 +3405,7 @@
}
}
llvm::SmallVector<Expr *, 8> AllArgs;
- VariadicCallType CallType =
+ VariadicCallType CallType =
Proto->isVariadic() ? VariadicFunction : VariadicDoesNotApply;
if (Fn->getType()->isBlockPointerType())
CallType = VariadicBlock; // Block
@@ -3418,7 +3418,7 @@
unsigned TotalNumArgs = AllArgs.size();
for (unsigned i = 0; i < TotalNumArgs; ++i)
Call->setArg(i, AllArgs[i]);
-
+
return false;
}
@@ -3439,23 +3439,23 @@
// Continue to check argument types (even if we have too few/many args).
for (unsigned i = FirstProtoArg; i != NumArgsToCheck; i++) {
QualType ProtoArgType = Proto->getArgType(i);
-
+
Expr *Arg;
if (ArgIx < NumArgs) {
Arg = Args[ArgIx++];
-
+
if (RequireCompleteType(Arg->getSourceRange().getBegin(),
ProtoArgType,
PDiag(diag::err_call_incomplete_argument)
<< Arg->getSourceRange()))
return true;
-
+
// Pass the argument
ParmVarDecl *Param = 0;
if (FDecl && i < FDecl->getNumParams())
Param = FDecl->getParamDecl(i);
-
+
InitializedEntity Entity =
Param? InitializedEntity::InitializeParameter(Param)
: InitializedEntity::InitializeParameter(ProtoArgType);
@@ -3468,17 +3468,17 @@
Arg = ArgE.takeAs<Expr>();
} else {
ParmVarDecl *Param = FDecl->getParamDecl(i);
-
+
OwningExprResult ArgExpr =
BuildCXXDefaultArgExpr(CallLoc, FDecl, Param);
if (ArgExpr.isInvalid())
return true;
-
+
Arg = ArgExpr.takeAs<Expr>();
}
AllArgs.push_back(Arg);
}
-
+
// If this is a variadic call, handle args passed through "...".
if (CallType != VariadicDoesNotApply) {
// Promote the arguments (C99 6.5.2.2p7).
@@ -3570,32 +3570,32 @@
return BuildCallToMemberFunction(S, Fn, LParenLoc, Args, NumArgs,
CommaLocs, RParenLoc);
}
-
+
// Determine whether this is a call to a pointer-to-member function.
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(NakedFn)) {
if (BO->getOpcode() == BinaryOperator::PtrMemD ||
BO->getOpcode() == BinaryOperator::PtrMemI) {
- if (const FunctionProtoType *FPT =
+ if (const FunctionProtoType *FPT =
dyn_cast<FunctionProtoType>(BO->getType())) {
QualType ResultTy = FPT->getResultType().getNonReferenceType();
-
- ExprOwningPtr<CXXMemberCallExpr>
- TheCall(this, new (Context) CXXMemberCallExpr(Context, BO, Args,
+
+ ExprOwningPtr<CXXMemberCallExpr>
+ TheCall(this, new (Context) CXXMemberCallExpr(Context, BO, Args,
NumArgs, ResultTy,
RParenLoc));
-
- if (CheckCallReturnType(FPT->getResultType(),
- BO->getRHS()->getSourceRange().getBegin(),
+
+ if (CheckCallReturnType(FPT->getResultType(),
+ BO->getRHS()->getSourceRange().getBegin(),
TheCall.get(), 0))
return ExprError();
- if (ConvertArgumentsForCall(&*TheCall, BO, 0, FPT, Args, NumArgs,
+ if (ConvertArgumentsForCall(&*TheCall, BO, 0, FPT, Args, NumArgs,
RParenLoc))
return ExprError();
return Owned(MaybeBindToTemporary(TheCall.release()).release());
}
- return ExprError(Diag(Fn->getLocStart(),
+ return ExprError(Diag(Fn->getLocStart(),
diag::err_typecheck_call_not_function)
<< Fn->getType() << Fn->getSourceRange());
}
@@ -3661,7 +3661,7 @@
<< Fn->getType() << Fn->getSourceRange());
// Check for a valid return type
- if (CheckCallReturnType(FuncT->getResultType(),
+ if (CheckCallReturnType(FuncT->getResultType(),
Fn->getSourceRange().getBegin(), TheCall.get(),
FDecl))
return ExprError();
@@ -3762,7 +3762,7 @@
InitializedEntity Entity
= InitializedEntity::InitializeTemporary(literalType);
InitializationKind Kind
- = InitializationKind::CreateCast(SourceRange(LParenLoc, RParenLoc),
+ = InitializationKind::CreateCast(SourceRange(LParenLoc, RParenLoc),
/*IsCStyleCast=*/true);
InitializationSequence InitSeq(*this, Entity, Kind, &literalExpr, 1);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
@@ -3780,7 +3780,7 @@
}
Result.release();
-
+
return Owned(new (Context) CompoundLiteralExpr(LParenLoc, TInfo, literalType,
literalExpr, isFileScope));
}
@@ -3807,13 +3807,13 @@
if (SrcTy->hasPointerRepresentation()) {
if (DestTy->hasPointerRepresentation())
- return DestTy->isObjCObjectPointerType() ?
- CastExpr::CK_AnyPointerToObjCPointerCast :
+ return DestTy->isObjCObjectPointerType() ?
+ CastExpr::CK_AnyPointerToObjCPointerCast :
CastExpr::CK_BitCast;
if (DestTy->isIntegerType())
return CastExpr::CK_PointerToIntegral;
}
-
+
if (SrcTy->isIntegerType()) {
if (DestTy->isIntegerType())
return CastExpr::CK_IntegralCast;
@@ -3822,14 +3822,14 @@
if (DestTy->isRealFloatingType())
return CastExpr::CK_IntegralToFloating;
}
-
+
if (SrcTy->isRealFloatingType()) {
if (DestTy->isRealFloatingType())
return CastExpr::CK_FloatingCast;
if (DestTy->isIntegerType())
return CastExpr::CK_FloatingToIntegral;
}
-
+
// FIXME: Assert here.
// assert(false && "Unhandled cast combination!");
return CastExpr::CK_Unknown;
@@ -3853,7 +3853,7 @@
Kind = CastExpr::CK_ToVoid;
return false;
}
-
+
if (!castType->isScalarType() && !castType->isVectorType()) {
if (Context.hasSameUnqualifiedType(castType, castExpr->getType()) &&
(castType->isStructureType() || castType->isUnionType())) {
@@ -3864,14 +3864,14 @@
Kind = CastExpr::CK_NoOp;
return false;
}
-
+
if (castType->isUnionType()) {
// GCC cast to union extension
RecordDecl *RD = castType->getAs<RecordType>()->getDecl();
RecordDecl::field_iterator Field, FieldEnd;
for (Field = RD->field_begin(), FieldEnd = RD->field_end();
Field != FieldEnd; ++Field) {
- if (Context.hasSameUnqualifiedType(Field->getType(),
+ if (Context.hasSameUnqualifiedType(Field->getType(),
castExpr->getType())) {
Diag(TyR.getBegin(), diag::ext_typecheck_cast_to_union)
<< castExpr->getSourceRange();
@@ -3884,22 +3884,22 @@
Kind = CastExpr::CK_ToUnion;
return false;
}
-
+
// Reject any other conversions to non-scalar types.
return Diag(TyR.getBegin(), diag::err_typecheck_cond_expect_scalar)
<< castType << castExpr->getSourceRange();
}
-
- if (!castExpr->getType()->isScalarType() &&
+
+ if (!castExpr->getType()->isScalarType() &&
!castExpr->getType()->isVectorType()) {
return Diag(castExpr->getLocStart(),
diag::err_typecheck_expect_scalar_operand)
<< castExpr->getType() << castExpr->getSourceRange();
}
-
- if (castType->isExtVectorType())
+
+ if (castType->isExtVectorType())
return CheckExtVectorCast(TyR, castType, castExpr, Kind);
-
+
if (castType->isVectorType())
return CheckVectorCast(TyR, castType, castExpr->getType(), Kind);
if (castExpr->getType()->isVectorType())
@@ -3907,10 +3907,10 @@
if (getLangOptions().ObjC1 && isa<ObjCSuperExpr>(castExpr))
return Diag(castExpr->getLocStart(), diag::err_illegal_super_cast) << TyR;
-
+
if (isa<ObjCSelectorExpr>(castExpr))
return Diag(castExpr->getLocStart(), diag::err_cast_selector_expr);
-
+
if (!castType->isArithmeticType()) {
QualType castExprType = castExpr->getType();
if (!castExprType->isIntegralType() && castExprType->isArithmeticType())
@@ -3948,12 +3948,12 @@
return false;
}
-bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *&CastExpr,
+bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *&CastExpr,
CastExpr::CastKind &Kind) {
assert(DestTy->isExtVectorType() && "Not an extended vector type!");
-
+
QualType SrcTy = CastExpr->getType();
-
+
// If SrcTy is a VectorType, the total size must match to explicitly cast to
// an ExtVectorType.
if (SrcTy->isVectorType()) {
@@ -3975,7 +3975,7 @@
QualType DestElemTy = DestTy->getAs<ExtVectorType>()->getElementType();
ImpCastExprToType(CastExpr, DestElemTy,
getScalarCastKind(Context, SrcTy, DestElemTy));
-
+
Kind = CastExpr::CK_VectorSplat;
return false;
}
@@ -4169,14 +4169,14 @@
ImpCastExprToType(LHS, RHSTy, CastExpr::CK_Unknown);
return RHSTy;
}
-
+
// All objective-c pointer type analysis is done here.
QualType compositeType = FindCompositeObjCPointerType(LHS, RHS,
QuestionLoc);
if (!compositeType.isNull())
return compositeType;
-
-
+
+
// Handle block pointer types.
if (LHSTy->isBlockPointerType() || RHSTy->isBlockPointerType()) {
if (!LHSTy->isBlockPointerType() || !RHSTy->isBlockPointerType()) {
@@ -4198,7 +4198,7 @@
// The block pointer types aren't identical, continue checking.
QualType lhptee = LHSTy->getAs<BlockPointerType>()->getPointeeType();
QualType rhptee = RHSTy->getAs<BlockPointerType>()->getPointeeType();
-
+
if (!Context.typesAreCompatible(lhptee.getUnqualifiedType(),
rhptee.getUnqualifiedType())) {
Diag(QuestionLoc, diag::warn_typecheck_cond_incompatible_pointers)
@@ -4216,7 +4216,7 @@
ImpCastExprToType(RHS, LHSTy, CastExpr::CK_BitCast);
return LHSTy;
}
-
+
// Check constraints for C object pointers types (C99 6.5.15p3,6).
if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
// get the "pointed to" types
@@ -4300,7 +4300,7 @@
SourceLocation QuestionLoc) {
QualType LHSTy = LHS->getType();
QualType RHSTy = RHS->getType();
-
+
// Handle things like Class and struct objc_class*. Here we case the result
// to the pseudo-builtin, because that will be implicitly cast back to the
// redefinition type if an attempt is made to access its fields.
@@ -4338,7 +4338,7 @@
}
// Check constraints for Objective-C object pointers types.
if (LHSTy->isObjCObjectPointerType() && RHSTy->isObjCObjectPointerType()) {
-
+
if (Context.getCanonicalType(LHSTy) == Context.getCanonicalType(RHSTy)) {
// Two identical object pointer types are always compatible.
return LHSTy;
@@ -4346,7 +4346,7 @@
const ObjCObjectPointerType *LHSOPT = LHSTy->getAs<ObjCObjectPointerType>();
const ObjCObjectPointerType *RHSOPT = RHSTy->getAs<ObjCObjectPointerType>();
QualType compositeType = LHSTy;
-
+
// If both operands are interfaces and either operand can be
// assigned to the other, use that type as the composite
// type. This allows
@@ -4357,7 +4357,7 @@
// allow silent coercion. Finally, if the types are
// incompatible then make sure to use 'id' as the composite
// type so the result is acceptable for sending messages to.
-
+
// FIXME: Consider unifying with 'areComparableObjCPointerTypes'.
// It could return the composite type.
if (Context.canAssignObjCInterfaces(LHSOPT, RHSOPT)) {
@@ -4374,7 +4374,7 @@
compositeType = Context.getObjCIdType();
} else if (LHSTy->isObjCIdType() || RHSTy->isObjCIdType()) {
compositeType = Context.getObjCIdType();
- } else if (!(compositeType =
+ } else if (!(compositeType =
Context.areCommonBaseCompatible(LHSOPT, RHSOPT)).isNull())
;
else {
@@ -4512,7 +4512,7 @@
lhptee = Context.UnsignedCharTy;
else if (lhptee->isSignedIntegerType())
lhptee = Context.getCorrespondingUnsignedType(lhptee);
-
+
if (rhptee->isCharType())
rhptee = Context.UnsignedCharTy;
else if (rhptee->isSignedIntegerType())
@@ -4526,7 +4526,7 @@
return ConvTy;
return IncompatiblePointerSign;
}
-
+
// If we are a multi-level pointer, it's possible that our issue is simply
// one of qualification - e.g. char ** -> const char ** is not allowed. If
// the eventual target type is the same and the pointers have the same
@@ -4535,15 +4535,15 @@
do {
lhptee = lhptee->getAs<PointerType>()->getPointeeType();
rhptee = rhptee->getAs<PointerType>()->getPointeeType();
-
+
lhptee = Context.getCanonicalType(lhptee);
rhptee = Context.getCanonicalType(rhptee);
} while (lhptee->isPointerType() && rhptee->isPointerType());
-
+
if (Context.hasSameUnqualifiedType(lhptee, rhptee))
return IncompatibleNestedPointerQualifiers;
}
-
+
// General pointer incompatibility takes priority over qualifiers.
return IncompatiblePointer;
}
@@ -4584,21 +4584,21 @@
Sema::CheckObjCPointerTypesForAssignment(QualType lhsType, QualType rhsType) {
if (lhsType->isObjCBuiltinType() || rhsType->isObjCBuiltinType())
return Compatible;
- QualType lhptee =
+ QualType lhptee =
lhsType->getAs<ObjCObjectPointerType>()->getPointeeType();
- QualType rhptee =
+ QualType rhptee =
rhsType->getAs<ObjCObjectPointerType>()->getPointeeType();
// make sure we operate on the canonical type
lhptee = Context.getCanonicalType(lhptee);
rhptee = Context.getCanonicalType(rhptee);
if (!lhptee.isAtLeastAsQualifiedAs(rhptee))
return CompatiblePointerDiscardsQualifiers;
-
+
if (Context.typesAreCompatible(lhsType, rhsType))
return Compatible;
if (lhsType->isObjCQualifiedIdType() || rhsType->isObjCQualifiedIdType())
return IncompatibleObjCQualifiedId;
- return IncompatiblePointer;
+ return IncompatiblePointer;
}
/// CheckAssignmentConstraints (C99 6.5.16) - This routine currently
@@ -4824,7 +4824,7 @@
break;
}
- if (rExpr->isNullPointerConstant(Context,
+ if (rExpr->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull)) {
ImpCastExprToType(rExpr, it->getType(), CastExpr::CK_IntegralToPointer);
InitField = *it;
@@ -4868,7 +4868,7 @@
if ((lhsType->isPointerType() ||
lhsType->isObjCObjectPointerType() ||
lhsType->isBlockPointerType())
- && rExpr->isNullPointerConstant(Context,
+ && rExpr->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull)) {
ImpCastExprToType(rExpr, lhsType, CastExpr::CK_Unknown);
return Compatible;
@@ -4976,13 +4976,13 @@
if (!lex->getType()->isArithmeticType() ||
!rex->getType()->isArithmeticType())
return InvalidOperands(Loc, lex, rex);
-
+
// Check for division by zero.
if (isDiv &&
rex->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull))
- DiagRuntimeBehavior(Loc, PDiag(diag::warn_division_by_zero)
+ DiagRuntimeBehavior(Loc, PDiag(diag::warn_division_by_zero)
<< rex->getSourceRange());
-
+
return compType;
}
@@ -4998,12 +4998,12 @@
if (!lex->getType()->isIntegerType() || !rex->getType()->isIntegerType())
return InvalidOperands(Loc, lex, rex);
-
+
// Check for remainder by zero.
if (rex->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull))
DiagRuntimeBehavior(Loc, PDiag(diag::warn_remainder_by_zero)
<< rex->getSourceRange());
-
+
return compType;
}
@@ -5319,13 +5319,13 @@
Expr *literalString = 0;
Expr *literalStringStripped = 0;
if ((isa<StringLiteral>(LHSStripped) || isa<ObjCEncodeExpr>(LHSStripped)) &&
- !RHSStripped->isNullPointerConstant(Context,
+ !RHSStripped->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull)) {
literalString = lex;
literalStringStripped = LHSStripped;
} else if ((isa<StringLiteral>(RHSStripped) ||
isa<ObjCEncodeExpr>(RHSStripped)) &&
- !LHSStripped->isNullPointerConstant(Context,
+ !LHSStripped->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull)) {
literalString = rex;
literalStringStripped = RHSStripped;
@@ -5342,7 +5342,7 @@
case BinaryOperator::NE: resultComparison = ") != 0"; break;
default: assert(false && "Invalid comparison operator");
}
-
+
DiagRuntimeBehavior(Loc,
PDiag(diag::warn_stringcompare)
<< isa<ObjCEncodeExpr>(literalStringStripped)
@@ -5371,9 +5371,9 @@
return ResultTy;
}
- bool LHSIsNull = lex->isNullPointerConstant(Context,
+ bool LHSIsNull = lex->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull);
- bool RHSIsNull = rex->isNullPointerConstant(Context,
+ bool RHSIsNull = rex->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull);
// All of the following pointer related warnings are GCC extensions, except
@@ -5416,9 +5416,9 @@
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
return QualType();
} else if (NonStandardCompositeType) {
- Diag(Loc,
+ Diag(Loc,
diag::ext_typecheck_comparison_of_distinct_pointers_nonstandard)
- << lType << rType << T
+ << lType << rType << T
<< lex->getSourceRange() << rex->getSourceRange();
}
@@ -5489,9 +5489,9 @@
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
return QualType();
} else if (NonStandardCompositeType) {
- Diag(Loc,
+ Diag(Loc,
diag::ext_typecheck_comparison_of_distinct_pointers_nonstandard)
- << lType << rType << T
+ << lType << rType << T
<< lex->getSourceRange() << rex->getSourceRange();
}
@@ -5677,10 +5677,10 @@
if (!lex->getType()->isScalarType() || !rex->getType()->isScalarType())
return InvalidOperands(Loc, lex, rex);
-
+
return Context.IntTy;
}
-
+
// C++ [expr.log.and]p1
// C++ [expr.log.or]p1
// The operands are both implicitly converted to type bool (clause 4).
@@ -5692,16 +5692,16 @@
if (PerformImplicitConversion(lex, Context.BoolTy, LHS,
AA_Passing, /*IgnoreBaseAccess=*/false))
return InvalidOperands(Loc, lex, rex);
-
+
StandardConversionSequence RHS;
if (!IsStandardConversion(rex, Context.BoolTy,
/*InOverloadResolution=*/false, RHS))
return InvalidOperands(Loc, lex, rex);
-
+
if (PerformImplicitConversion(rex, Context.BoolTy, RHS,
AA_Passing, /*IgnoreBaseAccess=*/false))
return InvalidOperands(Loc, lex, rex);
-
+
// C++ [expr.log.and]p2
// C++ [expr.log.or]p2
// The result is a bool.
@@ -6341,10 +6341,10 @@
Self.Diag(Loc, PD)
<< CodeModificationHint::CreateInsertion(ParenRange.getBegin(), "(")
<< CodeModificationHint::CreateInsertion(EndLoc, ")");
-
+
if (!SecondPD.getDiagID())
return;
-
+
EndLoc = Self.PP.getLocForEndOfToken(SecondParenRange.getEnd());
if (!SecondParenRange.getEnd().isFileID() || EndLoc.isInvalid()) {
// We can't display the parentheses, so just dig the
@@ -6352,7 +6352,7 @@
Self.Diag(Loc, SecondPD);
return;
}
-
+
Self.Diag(Loc, SecondPD)
<< CodeModificationHint::CreateInsertion(SecondParenRange.getBegin(), "(")
<< CodeModificationHint::CreateInsertion(EndLoc, ")");
@@ -6442,12 +6442,12 @@
if (S && OverOp != OO_None)
LookupOverloadedOperatorName(OverOp, S, lhs->getType(), rhs->getType(),
Functions);
-
+
// Build the (potentially-overloaded, potentially-dependent)
// binary operation.
return CreateOverloadedBinOp(OpLoc, Opc, Functions, lhs, rhs);
}
-
+
// Build a built-in binary operation.
return CreateBuiltinBinOp(OpLoc, Opc, lhs, rhs);
}
@@ -6555,10 +6555,10 @@
if (S && OverOp != OO_None)
LookupOverloadedOperatorName(OverOp, S, Input->getType(), QualType(),
Functions);
-
+
return CreateOverloadedUnaryOp(OpLoc, Opc, Functions, move(input));
}
-
+
return CreateBuiltinUnaryOp(OpLoc, Opc, move(input));
}
@@ -6818,7 +6818,7 @@
void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {
assert(ParamInfo.getIdentifier()==0 && "block-id should have no identifier!");
BlockScopeInfo *CurBlock = getCurBlock();
-
+
if (ParamInfo.getNumTypeObjects() == 0
|| ParamInfo.getTypeObject(0).Kind != DeclaratorChunk::Function) {
ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo);
@@ -6985,13 +6985,13 @@
PopFunctionOrBlockScope();
return ExprError();
}
-
+
AnalysisContext AC(BSI->TheDecl);
CheckFallThroughForBlock(BlockTy, BSI->TheDecl->getBody(), AC);
CheckUnreachable(AC);
Expr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy,
BSI->hasBlockDeclRefExprs);
- PopFunctionOrBlockScope();
+ PopFunctionOrBlockScope();
return Owned(Result);
}
@@ -7048,14 +7048,14 @@
return Owned(new (Context) GNUNullExpr(Ty, TokenLoc));
}
-static void
+static void
MakeObjCStringLiteralCodeModificationHint(Sema& SemaRef,
QualType DstType,
Expr *SrcExpr,
CodeModificationHint &Hint) {
if (!SemaRef.getLangOptions().ObjC1)
return;
-
+
const ObjCObjectPointerType *PT = DstType->getAs<ObjCObjectPointerType>();
if (!PT)
return;
@@ -7067,12 +7067,12 @@
if (!ID || !ID->getIdentifier()->isStr("NSString"))
return;
}
-
+
// Strip off any parens and casts.
StringLiteral *SL = dyn_cast<StringLiteral>(SrcExpr->IgnoreParenCasts());
if (!SL || SL->isWide())
return;
-
+
Hint = CodeModificationHint::CreateInsertion(SL->getLocStart(), "@");
}
@@ -7084,7 +7084,7 @@
bool isInvalid = false;
unsigned DiagKind;
CodeModificationHint Hint;
-
+
switch (ConvTy) {
default: assert(0 && "Unknown conversion type");
case Compatible: return false;
@@ -7201,7 +7201,7 @@
// Mark any remaining declarations in the current position of the stack
// as "referenced". If they were not meant to be referenced, semantic
// analysis would have eliminated them (e.g., in ActOnCXXTypeId).
- for (PotentiallyReferencedDecls::iterator
+ for (PotentiallyReferencedDecls::iterator
I = Rec.PotentiallyReferenced->begin(),
IEnd = Rec.PotentiallyReferenced->end();
I != IEnd; ++I)
@@ -7216,13 +7216,13 @@
I != IEnd; ++I)
Diag(I->first, I->second);
}
- }
+ }
// When are coming out of an unevaluated context, clear out any
// temporaries that we may have created as part of the evaluation of
// the expression in that context: they aren't relevant because they
// will never be constructed.
- if (Rec.Context == Unevaluated &&
+ if (Rec.Context == Unevaluated &&
ExprTemporaries.size() > Rec.NumTemporaries)
ExprTemporaries.erase(ExprTemporaries.begin() + Rec.NumTemporaries,
ExprTemporaries.end());
@@ -7251,7 +7251,7 @@
// template or not. The reason for this is that unevaluated expressions
// (e.g. (void)sizeof()) constitute a use for warning purposes (-Wunused-variables and
// -Wunused-parameters)
- if (isa<ParmVarDecl>(D) ||
+ if (isa<ParmVarDecl>(D) ||
(isa<VarDecl>(D) && D->getDeclContext()->isFunctionOrMethod()))
D->setUsed(true);
@@ -7289,7 +7289,7 @@
if (!Constructor->isUsed())
DefineImplicitCopyConstructor(Loc, Constructor, TypeQuals);
}
-
+
MaybeMarkVirtualMembersReferenced(Loc, Constructor);
} else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
if (Destructor->isImplicit() && !Destructor->isUsed())
@@ -7311,32 +7311,32 @@
= Function->getTemplateSpecializationInfo()) {
if (SpecInfo->getPointOfInstantiation().isInvalid())
SpecInfo->setPointOfInstantiation(Loc);
- else if (SpecInfo->getTemplateSpecializationKind()
+ else if (SpecInfo->getTemplateSpecializationKind()
== TSK_ImplicitInstantiation)
AlreadyInstantiated = true;
- } else if (MemberSpecializationInfo *MSInfo
+ } else if (MemberSpecializationInfo *MSInfo
= Function->getMemberSpecializationInfo()) {
if (MSInfo->getPointOfInstantiation().isInvalid())
MSInfo->setPointOfInstantiation(Loc);
- else if (MSInfo->getTemplateSpecializationKind()
+ else if (MSInfo->getTemplateSpecializationKind()
== TSK_ImplicitInstantiation)
AlreadyInstantiated = true;
}
-
+
if (!AlreadyInstantiated) {
if (isa<CXXRecordDecl>(Function->getDeclContext()) &&
cast<CXXRecordDecl>(Function->getDeclContext())->isLocalClass())
PendingLocalImplicitInstantiations.push_back(std::make_pair(Function,
Loc));
else
- PendingImplicitInstantiations.push_back(std::make_pair(Function,
+ PendingImplicitInstantiations.push_back(std::make_pair(Function,
Loc));
}
}
-
+
// FIXME: keep track of references to static functions
Function->setUsed(true);
-
+
return;
}
@@ -7364,29 +7364,29 @@
/// of the program being compiled.
///
/// This routine emits the given diagnostic when the code currently being
-/// type-checked is "potentially evaluated", meaning that there is a
+/// type-checked is "potentially evaluated", meaning that there is a
/// possibility that the code will actually be executable. Code in sizeof()
/// expressions, code used only during overload resolution, etc., are not
/// potentially evaluated. This routine will suppress such diagnostics or,
/// in the absolutely nutty case of potentially potentially evaluated
-/// expressions (C++ typeid), queue the diagnostic to potentially emit it
+/// expressions (C++ typeid), queue the diagnostic to potentially emit it
/// later.
-///
+///
/// This routine should be used for all diagnostics that describe the run-time
/// behavior of a program, such as passing a non-POD value through an ellipsis.
/// Failure to do so will likely result in spurious diagnostics or failures
/// during overload resolution or within sizeof/alignof/typeof/typeid.
-bool Sema::DiagRuntimeBehavior(SourceLocation Loc,
+bool Sema::DiagRuntimeBehavior(SourceLocation Loc,
const PartialDiagnostic &PD) {
switch (ExprEvalContexts.back().Context ) {
case Unevaluated:
// The argument will never be evaluated, so don't complain.
break;
-
+
case PotentiallyEvaluated:
Diag(Loc, PD);
return true;
-
+
case PotentiallyPotentiallyEvaluated:
ExprEvalContexts.back().addDiagnostic(Loc, PD);
break;
@@ -7404,12 +7404,12 @@
FD ? PDiag(diag::note_function_with_incomplete_return_type_declared_here)
<< FD->getDeclName() : PDiag();
SourceLocation NoteLoc = FD ? FD->getLocation() : SourceLocation();
-
+
if (RequireCompleteType(Loc, ReturnType,
- FD ?
+ FD ?
PDiag(diag::err_call_function_incomplete_return)
<< CE->getSourceRange() << FD->getDeclName() :
- PDiag(diag::err_call_incomplete_return)
+ PDiag(diag::err_call_incomplete_return)
<< CE->getSourceRange(),
std::make_pair(NoteLoc, Note)))
return true;
@@ -7459,7 +7459,7 @@
SourceLocation Open = E->getSourceRange().getBegin();
SourceLocation Close = PP.getLocForEndOfToken(E->getSourceRange().getEnd());
-
+
Diag(Loc, diagnostic)
<< E->getSourceRange()
<< CodeModificationHint::CreateInsertion(Open, "(")
More information about the cfe-commits
mailing list