diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-02-12 23:50:26 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-02-12 23:50:26 +0000 |
commit | c0dca6ded73199d6a111f8b785a3a0295eb57f31 (patch) | |
tree | 294643f74f87ab60896c5c94f4762019d298cf2a /clang/lib/Lex/Preprocessor.cpp | |
parent | c7d8885be4fe0479eda490d483059ca3dd46390a (diff) | |
download | bcm5719-llvm-c0dca6ded73199d6a111f8b785a3a0295eb57f31.tar.gz bcm5719-llvm-c0dca6ded73199d6a111f8b785a3a0295eb57f31.zip |
MS ABI: Implement #pragma vtordisp() and clang-cl /vdN
These features are new in VS 2013 and are necessary in order to layout
std::ostream correctly. Currently we have an ABI incompatibility when
self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper
in gtest.
This change adds another implicit attribute, MSVtorDispAttr, because
implicit attributes are currently the best way to make sure the
information stays on class templates through instantiation.
Reviewers: majnemer
Differential Revision: http://llvm-reviews.chandlerc.com/D2746
llvm-svn: 201274
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 68201b39f69..9ffc83ceffb 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -819,6 +819,24 @@ bool Preprocessor::FinishLexStringLiteral(Token &Result, std::string &String, return true; } +bool Preprocessor::parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value) { + assert(Tok.is(tok::numeric_constant)); + SmallString<8> IntegerBuffer; + bool NumberInvalid = false; + StringRef Spelling = getSpelling(Tok, IntegerBuffer, &NumberInvalid); + if (NumberInvalid) + return false; + NumericLiteralParser Literal(Spelling, Tok.getLocation(), *this); + if (Literal.hadError || !Literal.isIntegerLiteral() || Literal.hasUDSuffix()) + return false; + llvm::APInt APVal(64, 0); + if (Literal.GetIntegerValue(APVal)) + return false; + Lex(Tok); + Value = APVal.getLimitedValue(); + return true; +} + void Preprocessor::addCommentHandler(CommentHandler *Handler) { assert(Handler && "NULL comment handler"); assert(std::find(CommentHandlers.begin(), CommentHandlers.end(), Handler) == |