nickdesaulniers added inline comments.

================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:980-981
+    StringRef BaseInput = StringRef(II.getBaseInput());
+    types::ID InputType = types::lookupTypeForExtension(
+        llvm::sys::path::extension(BaseInput).drop_front());
+    if (InputType == types::TY_Asm || InputType == types::TY_PP_Asm)
----------------
garvitgupta08 wrote:
> nickdesaulniers wrote:
> > The following input causes clang to crash:
> > 
> > ```
> > $ clang -fno-integrated-as -c -x assembler-with-cpp /dev/null
> > clang: /android0/llvm-project/llvm/include/llvm/ADT/StringRef.h:597: 
> > llvm::StringRef llvm::StringRef::drop_front(size_t) const: Assertion 
> > `size() >= N && "Dropping more elements than exist"' failed.
> > ```
> > 
> > Please fix that and add a test case for `/dev/null` (i.e. inputs for which 
> > no extension exists).
> For Inputs without extension, will there always be a -x flag?
I assume the input can have any extension or no extension. Maybe find where in 
clang we decide we don't know the extension, and emulate a similar approach?

For example, `clang foo.xyz` will complain that we don't know the source 
language. `clang -x c foo.xyz` should shut up the warning if `foo.xyz` is a 
valid c file.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145726/new/

https://reviews.llvm.org/D145726

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to