[cfe-commits] r39050 - in /cfe/cfe/trunk: AST/Expr.cpp AST/Sema.cpp Sema/Sema.cpp include/clang/AST/Expr.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:27:08 PDT 2007
Author: sabre
Date: Wed Jul 11 11:27:08 2007
New Revision: 39050
URL: http://llvm.org/viewvc/llvm-project?rev=39050&view=rev
Log:
Handle __extension__ as a unary operator if requested.
Modified:
cfe/cfe/trunk/AST/Expr.cpp
cfe/cfe/trunk/AST/Sema.cpp
cfe/cfe/trunk/Sema/Sema.cpp
cfe/cfe/trunk/include/clang/AST/Expr.h
Modified: cfe/cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Expr.cpp?rev=39050&r1=39049&r2=39050&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Expr.cpp (original)
+++ cfe/cfe/trunk/AST/Expr.cpp Wed Jul 11 11:27:08 2007
@@ -65,7 +65,7 @@
/// corresponds to, e.g. "sizeof" or "[pre]++".
const char *UnaryOperator::getOpcodeStr(Opcode Op) {
switch (Op) {
- default: assert(0 && "Unknown binary operator");
+ default: assert(0 && "Unknown unary operator");
case PostInc: return "[post]++";
case PostDec: return "[post]--";
case PreInc: return "[pre]++";
@@ -80,6 +80,7 @@
case Imag: return "__imag";
case SizeOf: return "sizeof";
case AlignOf: return "alignof";
+ case Extension: return "__extension__";
}
}
Modified: cfe/cfe/trunk/AST/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.cpp?rev=39050&r1=39049&r2=39050&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Sema.cpp (original)
+++ cfe/cfe/trunk/AST/Sema.cpp Wed Jul 11 11:27:08 2007
@@ -277,6 +277,10 @@
case tok::kw___real: Opc = UnaryOperator::Real; break;
case tok::kw___imag: Opc = UnaryOperator::Imag; break;
case tok::ampamp: Opc = UnaryOperator::AddrLabel; break;
+ case tok::kw___extension__:
+ if (!FullLocInfo) return Input;
+ Opc = UnaryOperator::Extension;
+ break;
}
if (!FullLocInfo)
Modified: cfe/cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.cpp?rev=39050&r1=39049&r2=39050&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/cfe/trunk/Sema/Sema.cpp Wed Jul 11 11:27:08 2007
@@ -277,6 +277,10 @@
case tok::kw___real: Opc = UnaryOperator::Real; break;
case tok::kw___imag: Opc = UnaryOperator::Imag; break;
case tok::ampamp: Opc = UnaryOperator::AddrLabel; break;
+ case tok::kw___extension__:
+ if (!FullLocInfo) return Input;
+ Opc = UnaryOperator::Extension;
+ break;
}
if (!FullLocInfo)
Modified: cfe/cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Expr.h?rev=39050&r1=39049&r2=39050&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Expr.h Wed Jul 11 11:27:08 2007
@@ -108,7 +108,8 @@
Not, LNot, // [C99 6.5.3.3] Unary arithmetic operators.
SizeOf, AlignOf, // [C99 6.5.3.4] Sizeof (expr, not type) operator.
Real, Imag, // "__real expr"/"__imag expr" Extension.
- AddrLabel // && label Extension.
+ AddrLabel, // && label Extension.
+ Extension // __extension__ marker.
};
UnaryOperator(Expr *input, Opcode opc)
More information about the cfe-commits
mailing list