Send cfe-commits mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of cfe-commits digest..."
Today's Topics:
1. [PATCH] Select correct clang++ output directory when building
with cmake as sub directory on Windows (Kenneth Benzie)
2. r198603 - Rename getTokenSimpleSpelling() to
getPunctuatorSpelling() (Alp Toker)
3. r198604 - Support diagnostic formatting of keyword tokens
(Alp Toker)
4. r198605 - Don't use magic constants in the digraph diagnostic
(Alp Toker)
5. r198606 - Simplify diagnostic tag type using the token kind
formatter (Alp Toker)
6. r198607 - Correct underlying integer type of enum TokenKind
(Alp Toker)
----------------------------------------------------------------------
Message: 1
Date: Mon, 6 Jan 2014 04:57:35 -0800
From: Kenneth Benzie <[email protected]>
To: [email protected], [email protected]
Cc: [email protected]
Subject: [PATCH] Select correct clang++ output directory when building
with cmake as sub directory on Windows
Message-ID:
<differential-rev-phid-drev-6zhaua47hjbcjaxt4dl3-...@llvm-reviews.chandlerc.com>
Content-Type: text/plain; charset="utf-8"
Hi chandlerc,
When a root CMakeLists adds llvm as a sub directory on windows the post build
step which copies clang++.exe fails due clang.exe not being found.
This is due to the CMAKE_BINARY_DIR variable pointing to the wrong directory,
using LLVM_BINARY_DIR instead fixes this issue.
http://llvm-reviews.chandlerc.com/D2515
Files:
CMakeLists.txt
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -174,8 +174,8 @@
set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
-set(CLANG_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
-set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
+set(CLANG_RUNTIME_OUTPUT_INTDIR ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+set(CLANG_LIBRARY_OUTPUT_INTDIR ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite
"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2515.1.patch
Type: text/x-patch
Size: 713 bytes
Desc: not available
URL:
<http://lists.cs.uiuc.edu/pipermail/cfe-commits/attachments/20140106/d8a7e996/attachment-0001.bin>
------------------------------
Message: 2
Date: Mon, 06 Jan 2014 12:54:08 -0000
From: Alp Toker <[email protected]>
To: [email protected]
Subject: r198603 - Rename getTokenSimpleSpelling() to
getPunctuatorSpelling()
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Author: alp
Date: Mon Jan 6 06:54:07 2014
New Revision: 198603
URL: http://llvm.org/viewvc/llvm-project?rev=198603&view=rev
Log:
Rename getTokenSimpleSpelling() to getPunctuatorSpelling()
That's what it does, what the documentation says it does and what callers
expect it to do.
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.h
cfe/trunk/lib/Basic/Diagnostic.cpp
cfe/trunk/lib/Basic/TokenKinds.cpp
cfe/trunk/lib/Parse/Parser.cpp
Modified: cfe/trunk/include/clang/Basic/TokenKinds.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.h?rev=198603&r1=198602&r2=198603&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.h (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.h Mon Jan 6 06:54:07 2014
@@ -63,7 +63,7 @@ const char *getTokenName(enum TokenKind
/// and will not produce any alternative spellings (e.g., a
/// digraph). For the actual spelling of a given Token, use
/// Preprocessor::getSpelling().
-const char *getTokenSimpleSpelling(enum TokenKind Kind) LLVM_READNONE;
+const char *getPunctuatorSpelling(enum TokenKind Kind) LLVM_READNONE;
/// \brief Return true if this is a raw identifier or an identifier kind.
inline bool isAnyIdentifier(TokenKind K) {
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=198603&r1=198602&r2=198603&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Mon Jan 6 06:54:07 2014
@@ -831,7 +831,7 @@ FormatDiagnostic(const char *DiagStr, co
if (const char *S = getTokenNameForDiagnostic(Kind))
// Unquoted translatable token name.
Out << S;
- else if (const char *S = tok::getTokenSimpleSpelling(Kind))
+ else if (const char *S = tok::getPunctuatorSpelling(Kind))
// Quoted token spelling, currently only covers punctuators.
Out << '\'' << S << '\'';
else if (const char *S = tok::getTokenName(Kind))
Modified: cfe/trunk/lib/Basic/TokenKinds.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TokenKinds.cpp?rev=198603&r1=198602&r2=198603&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TokenKinds.cpp (original)
+++ cfe/trunk/lib/Basic/TokenKinds.cpp Mon Jan 6 06:54:07 2014
@@ -29,7 +29,7 @@ const char *tok::getTokenName(enum Token
return 0;
}
-const char *tok::getTokenSimpleSpelling(enum TokenKind Kind) {
+const char *tok::getPunctuatorSpelling(enum TokenKind Kind) {
switch (Kind) {
#define PUNCTUATOR(X,Y) case X: return Y;
#include "clang/Basic/TokenKinds.def"
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=198603&r1=198602&r2=198603&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Mon Jan 6 06:54:07 2014
@@ -164,7 +164,7 @@ bool Parser::ExpectAndConsume(tok::Token
SourceLocation Loc = Tok.getLocation();
DiagnosticBuilder DB = Diag(Loc, DiagID);
DB << FixItHint::CreateReplacement(SourceRange(Loc),
- getTokenSimpleSpelling(ExpectedTok));
+ getPunctuatorSpelling(ExpectedTok));
if (DiagID == diag::err_expected)
DB << ExpectedTok;
else if (DiagID == diag::err_expected_after)
@@ -180,7 +180,7 @@ bool Parser::ExpectAndConsume(tok::Token
SourceLocation EndLoc = PP.getLocForEndOfToken(PrevTokLocation);
const char *Spelling = 0;
if (EndLoc.isValid())
- Spelling = tok::getTokenSimpleSpelling(ExpectedTok);
+ Spelling = tok::getPunctuatorSpelling(ExpectedTok);
DiagnosticBuilder DB =
Spelling
------------------------------
Message: 3
Date: Mon, 06 Jan 2014 12:54:19 -0000
From: Alp Toker <[email protected]>
To: [email protected]
Subject: r198604 - Support diagnostic formatting of keyword tokens
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Author: alp
Date: Mon Jan 6 06:54:18 2014
New Revision: 198604
URL: http://llvm.org/viewvc/llvm-project?rev=198604&view=rev
Log:
Support diagnostic formatting of keyword tokens
Implemented with a new getKeywordSpelling() accessor. Unlike getTokenName() the
result of this function is stable and may be used in diagnostic output.
Uses of this feature are split out into the subsequent commit.
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.h
cfe/trunk/lib/Basic/Diagnostic.cpp
cfe/trunk/lib/Basic/TokenKinds.cpp
Modified: cfe/trunk/include/clang/Basic/TokenKinds.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.h?rev=198604&r1=198603&r2=198604&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.h (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.h Mon Jan 6 06:54:18 2014
@@ -65,6 +65,10 @@ const char *getTokenName(enum TokenKind
/// Preprocessor::getSpelling().
const char *getPunctuatorSpelling(enum TokenKind Kind) LLVM_READNONE;
+/// \brief Determines the spelling of simple keyword and contextual keyword
+/// tokens like 'int' and 'dynamic_cast'. Returns NULL for other token kinds.
+const char *getKeywordSpelling(enum TokenKind Kind) LLVM_READNONE;
+
/// \brief Return true if this is a raw identifier or an identifier kind.
inline bool isAnyIdentifier(TokenKind K) {
return (K == tok::identifier) || (K == tok::raw_identifier);
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=198604&r1=198603&r2=198604&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Mon Jan 6 06:54:18 2014
@@ -639,12 +639,15 @@ static void HandlePluralModifier(const D
}
}
-/// \brief Returns the friendly name for a token kind that will / appear
-// without quotes in diagnostic messages.
-static const char *getTokenNameForDiagnostic(tok::TokenKind Kind) {
+/// \brief Returns the friendly description for a token kind that will appear
+/// without quotes in diagnostic messages. These strings may be translatable in
+/// future.
+static const char *getTokenDescForDiagnostic(tok::TokenKind Kind) {
switch (Kind) {
case tok::identifier:
return "identifier";
+ case tok::annot_template_id:
+ return "template name";
default:
return 0;
}
@@ -828,12 +831,15 @@ FormatDiagnostic(const char *DiagStr, co
assert(ModifierLen == 0 && "No modifiers for token kinds yet");
llvm::raw_svector_ostream Out(OutStr);
- if (const char *S = getTokenNameForDiagnostic(Kind))
+ if (const char *S = tok::getPunctuatorSpelling(Kind))
+ // Quoted token spelling for punctuators.
+ Out << '\'' << S << '\'';
+ else if (const char *S = tok::getKeywordSpelling(Kind))
+ // Unquoted token spelling for keywords.
+ Out << S;
+ else if (const char *S = getTokenDescForDiagnostic(Kind))
// Unquoted translatable token name.
Out << S;
- else if (const char *S = tok::getPunctuatorSpelling(Kind))
- // Quoted token spelling, currently only covers punctuators.
- Out << '\'' << S << '\'';
else if (const char *S = tok::getTokenName(Kind))
// Debug name, shouldn't appear in user-facing diagnostics.
Out << '<' << S << '>';
Modified: cfe/trunk/lib/Basic/TokenKinds.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TokenKinds.cpp?rev=198604&r1=198603&r2=198604&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TokenKinds.cpp (original)
+++ cfe/trunk/lib/Basic/TokenKinds.cpp Mon Jan 6 06:54:18 2014
@@ -35,6 +35,14 @@ const char *tok::getPunctuatorSpelling(e
#include "clang/Basic/TokenKinds.def"
default: break;
}
+ return 0;
+}
+const char *tok::getKeywordSpelling(enum TokenKind Kind) {
+ switch (Kind) {
+#define KEYWORD(X,Y) case kw_ ## X: return #X;
+#include "clang/Basic/TokenKinds.def"
+ default: break;
+ }
return 0;
}
------------------------------
Message: 4
Date: Mon, 06 Jan 2014 12:54:33 -0000
From: Alp Toker <[email protected]>
To: [email protected]
Subject: r198605 - Don't use magic constants in the digraph diagnostic
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Author: alp
Date: Mon Jan 6 06:54:32 2014
New Revision: 198605
URL: http://llvm.org/viewvc/llvm-project?rev=198605&view=rev
Log:
Don't use magic constants in the digraph diagnostic
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseExprCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=198605&r1=198604&r2=198605&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Jan 6 06:54:32
2014
@@ -641,9 +641,7 @@ def err_ctor_init_missing_comma : Error<
def err_friend_decl_defines_type : Error<
"cannot define a type in a friend declaration">;
def err_missing_whitespace_digraph : Error<
- "found '<::' after a "
- "%select{template
name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0"
- " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">;
+ "found '<::' after a %0 which forms the digraph '<:' (aka '[') and a ':', did you mean
'< ::'?">;
def ext_deleted_function : ExtWarn<
"deleted function definitions are a C++11 extension">, InGroup<CXX11>;
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=198605&r1=198604&r2=198605&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Mon Jan 6 06:54:32 2014
@@ -24,18 +24,6 @@
using namespace clang;
-static int SelectDigraphErrorMessage(tok::TokenKind Kind) {
- switch (Kind) {
- case tok::kw_template: return 0;
- case tok::kw_const_cast: return 1;
- case tok::kw_dynamic_cast: return 2;
- case tok::kw_reinterpret_cast: return 3;
- case tok::kw_static_cast: return 4;
- default:
- llvm_unreachable("Unknown type for digraph error message.");
- }
-}
-
// Are the two tokens adjacent in the same source file?
bool Parser::areTokensAdjacent(const Token &First, const Token &Second) {
SourceManager &SM = PP.getSourceManager();
@@ -56,8 +44,7 @@ static void FixDigraph(Parser &P, Prepro
Range.setBegin(DigraphToken.getLocation());
Range.setEnd(ColonToken.getLocation());
P.Diag(DigraphToken.getLocation(), diag::err_missing_whitespace_digraph)
- << SelectDigraphErrorMessage(Kind)
- << FixItHint::CreateReplacement(Range, "< ::");
+ << Kind << FixItHint::CreateReplacement(Range, "< ::");
// Update token information to reflect their change in token type.
ColonToken.setKind(tok::coloncolon);
@@ -93,8 +80,8 @@ void Parser::CheckForTemplateAndDigraph(
Template, MemberOfUnknownSpecialization))
return;
- FixDigraph(*this, PP, Next, SecondToken, tok::kw_template,
- /*AtDigraph*/false);
+ FixDigraph(*this, PP, Next, SecondToken, tok::annot_template_id,
+ /*AtDigraph*/ false);
}
/// \brief Emits an error for a left parentheses after a double colon.
------------------------------
Message: 5
Date: Mon, 06 Jan 2014 12:54:41 -0000
From: Alp Toker <[email protected]>
To: [email protected]
Subject: r198606 - Simplify diagnostic tag type using the token kind
formatter
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Author: alp
Date: Mon Jan 6 06:54:41 2014
New Revision: 198606
URL: http://llvm.org/viewvc/llvm-project?rev=198606&view=rev
Log:
Simplify diagnostic tag type using the token kind formatter
As far as the parser is concerned the tag type is always a keyword.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=198606&r1=198605&r2=198606&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Jan 6 06:54:41
2014
@@ -627,8 +627,7 @@ def err_typename_refers_to_non_type_temp
def err_expected_type_name_after_typename : Error<
"expected an identifier or template-id after '::'">;
def err_explicit_spec_non_template : Error<
- "explicit %select{specialization|instantiation}0 of non-template "
- "%select{class|struct|union|interface}1 %2">;
+ "explicit %select{specialization|instantiation}0 of non-template %1 %2">;
def err_default_template_template_parameter_not_template : Error<
"default template argument for a template template parameter must be a class
"
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=198606&r1=198605&r2=198606&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Jan 6 06:54:41 2014
@@ -1237,13 +1237,8 @@ void Parser::ParseClassSpecifier(tok::To
}
Diag(NameLoc, diag::err_explicit_spec_non_template)
- << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
- << (TagType == DeclSpec::TST_class? 0
- : TagType == DeclSpec::TST_struct? 1
- : TagType == DeclSpec::TST_union? 2
- : 3)
- << Name
- << SourceRange(LAngleLoc, RAngleLoc);
+ << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
+ << TagTokKind << Name << SourceRange(LAngleLoc, RAngleLoc);
// Strip off the last template parameter list if it was empty, since
// we've removed its template argument list.
------------------------------
Message: 6
Date: Mon, 06 Jan 2014 12:54:51 -0000
From: Alp Toker <[email protected]>
To: [email protected]
Subject: r198607 - Correct underlying integer type of enum TokenKind
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Author: alp
Date: Mon Jan 6 06:54:51 2014
New Revision: 198607
URL: http://llvm.org/viewvc/llvm-project?rev=198607&view=rev
Log:
Correct underlying integer type of enum TokenKind
This matches up the underlying type against the actual storage type 'unsigned
short' and lets us get rid of some casts while we're at it.
Effort is made to keep this building in pre-C++11 but as with other features
Token will be less efficiently packed in in legacy configurations.
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/include/clang/Basic/TokenKinds.h
cfe/trunk/include/clang/Lex/Token.h
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=198607&r1=198606&r2=198607&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Mon Jan 6 06:54:51 2014
@@ -40,7 +40,7 @@ namespace clang {
class StoredDiagnostic;
#if LLVM_HAS_STRONG_ENUMS
namespace tok {
- enum TokenKind : unsigned;
+ enum TokenKind : unsigned short;
}
#endif
Modified: cfe/trunk/include/clang/Basic/TokenKinds.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.h?rev=198607&r1=198606&r2=198607&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.h (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.h Mon Jan 6 06:54:51 2014
@@ -22,7 +22,7 @@ namespace clang {
namespace tok {
/// \brief Provides a simple uniform namespace for tokens from all C languages.
-enum TokenKind LLVM_ENUM_INT_TYPE(unsigned) {
+enum TokenKind LLVM_ENUM_INT_TYPE(unsigned short) {
#define TOK(X) X,
#include "clang/Basic/TokenKinds.def"
NUM_TOKENS
Modified: cfe/trunk/include/clang/Lex/Token.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Token.h?rev=198607&r1=198606&r2=198607&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Token.h (original)
+++ cfe/trunk/include/clang/Lex/Token.h Mon Jan 6 06:54:51 2014
@@ -62,8 +62,7 @@ class Token {
void *PtrData;
/// Kind - The actual flavor of token this is.
- ///
- unsigned short Kind;
+ tok::TokenKind Kind;
/// Flags - Bits we track about this token, members of the TokenFlags enum.
unsigned char Flags;
@@ -83,13 +82,13 @@ public:
IgnoredComma = 0x80 // This comma is not a macro argument separator
(MS).
};
- tok::TokenKind getKind() const { return (tok::TokenKind)Kind; }
+ tok::TokenKind getKind() const { return Kind; }
void setKind(tok::TokenKind K) { Kind = K; }
/// is/isNot - Predicates to check if this token is a specific kind, as in
/// "if (Tok.is(tok::l_brace)) {...}".
- bool is(tok::TokenKind K) const { return Kind == (unsigned) K; }
- bool isNot(tok::TokenKind K) const { return Kind != (unsigned) K; }
+ bool is(tok::TokenKind K) const { return Kind == K; }
+ bool isNot(tok::TokenKind K) const { return Kind != K; }
/// \brief Return true if this is a raw identifier (when lexing
/// in raw mode) or a non-keyword identifier (when lexing in non-raw mode).
@@ -145,9 +144,7 @@ public:
setAnnotationEndLoc(R.getEnd());
}
- const char *getName() const {
- return tok::getTokenName( (tok::TokenKind) Kind);
- }
+ const char *getName() const { return tok::getTokenName(Kind); }
/// \brief Reset all flags to cleared.
void startToken() {
------------------------------
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
End of cfe-commits Digest, Vol 79, Issue 51
*******************************************